Skip to content

Commit 66a4169

Browse files
committed
Small refactorings
1 parent 1f47559 commit 66a4169

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Network/UdpConnection.cs

+7-10
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ internal UdpConnection(UdpClient udpClient, IPEndPoint remoteEndPoint, bool writ
7171
ObjectMapRefreshed();
7272

7373
KeepAlive = false;
74-
socket.SendTimeout = 0;
75-
socket.ReceiveTimeout = 0;
74+
socket.SendTimeout = -1;
75+
socket.ReceiveTimeout = -1;
7676

7777
if (IsWindows)
7878
socket.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);
@@ -89,20 +89,20 @@ internal UdpConnection(UdpClient udpClient, IPEndPoint remoteEndPoint, bool writ
8989
#region Properties
9090

9191
/// <inheritdoc />
92-
public override IPEndPoint IPLocalEndPoint { get { return localEndPoint; } }
92+
public override IPEndPoint IPLocalEndPoint => localEndPoint;
9393

9494
/// <summary>
9595
/// The local <see cref="EndPoint"/> for the <see cref="socket"/>.
9696
/// </summary>
97-
public EndPoint LocalEndPoint { get { return socket.LocalEndPoint; } }
97+
public EndPoint LocalEndPoint => localEndPoint;
9898

9999
/// <inheritdoc />
100-
public override IPEndPoint IPRemoteEndPoint { get { return localEndPoint; } }
100+
public override IPEndPoint IPRemoteEndPoint => localEndPoint;
101101

102102
/// <summary>
103103
/// The remote <see cref="EndPoint"/> for the <see cref="socket"/>.
104104
/// </summary>
105-
public EndPoint RemoteEndPoint { get { return remoteEndPoint; } }
105+
public EndPoint RemoteEndPoint => remoteEndPoint;
106106

107107
/// <inheritdoc />
108108
public override bool DualMode { get { return socket.DualMode; } set { socket.DualMode = value; } }
@@ -226,10 +226,7 @@ protected override void HandleUnknownPacket()
226226
}
227227

228228
/// <inheritdoc />
229-
protected override void CloseHandler(CloseReason closeReason)
230-
{
231-
Close(closeReason, true);
232-
}
229+
protected override void CloseHandler(CloseReason closeReason) => Close(closeReason, true);
233230

234231
/// <inheritdoc />
235232
protected override void CloseSocket()

0 commit comments

Comments
 (0)