Skip to content

Commit 9dcdbf0

Browse files
committed
update
1 parent 44647af commit 9dcdbf0

6 files changed

Lines changed: 32 additions & 32 deletions

File tree

examples/TcpChatServer/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace TcpChatServer
88
{
99
class ChatSession : TcpSession
1010
{
11-
public ChatSession(TcpServer server) : base(server) { }
11+
public ChatSession(TcpServer server) : base(server) {}
1212

1313
protected override void OnConnected()
1414
{

performance/TcpEchoServer/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace TcpEchoServer
88
{
99
class EchoSession : TcpSession
1010
{
11-
public EchoSession(TcpServer server) : base(server) { }
11+
public EchoSession(TcpServer server) : base(server) {}
1212

1313
protected override void OnReceived(byte[] buffer, long size)
1414
{

performance/TcpMulticastServer/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace TcpMulticastServer
1010
{
1111
class MulticastSession : TcpSession
1212
{
13-
public MulticastSession(TcpServer server) : base(server) { }
13+
public MulticastSession(TcpServer server) : base(server) {}
1414

1515
public override bool Send(byte[] buffer, long offset, long size)
1616
{

source/NetCoreServer/UdpClient.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public virtual bool Disconnect()
202202
// Dispose the client socket
203203
Socket.Dispose();
204204
}
205-
catch (ObjectDisposedException) { }
205+
catch (ObjectDisposedException) {}
206206

207207
// Update the connected flag
208208
IsConnected = false;
@@ -483,7 +483,7 @@ private void TryReceive()
483483
if (!Socket.ReceiveFromAsync(_receiveEventArg))
484484
ProcessReceiveFrom(_receiveEventArg);
485485
}
486-
catch (ObjectDisposedException) { }
486+
catch (ObjectDisposedException) {}
487487
}
488488

489489
/// <summary>
@@ -506,7 +506,7 @@ private void TrySend()
506506
if (!Socket.SendToAsync(_sendEventArg))
507507
ProcessSendTo(_sendEventArg);
508508
}
509-
catch (ObjectDisposedException) { }
509+
catch (ObjectDisposedException) {}
510510
}
511511

512512
/// <summary>
@@ -624,22 +624,22 @@ private void ProcessSendTo(SocketAsyncEventArgs e)
624624
/// <summary>
625625
/// Handle client connected notification
626626
/// </summary>
627-
protected virtual void OnConnected() { }
627+
protected virtual void OnConnected() {}
628628
/// <summary>
629629
/// Handle client disconnected notification
630630
/// </summary>
631-
protected virtual void OnDisconnected() { }
631+
protected virtual void OnDisconnected() {}
632632

633633
/// <summary>
634634
/// Handle client joined multicast group notification
635635
/// </summary>
636636
/// <param name="address">IP address</param>
637-
protected virtual void OnJoinedMulticastGroup(IPAddress address) { }
637+
protected virtual void OnJoinedMulticastGroup(IPAddress address) {}
638638
/// <summary>
639639
/// Handle client left multicast group notification
640640
/// </summary>
641641
/// <param name="address">IP address</param>
642-
protected virtual void OnLeftMulticastGroup(IPAddress address) { }
642+
protected virtual void OnLeftMulticastGroup(IPAddress address) {}
643643

644644
/// <summary>
645645
/// Handle datagram received notification
@@ -650,7 +650,7 @@ protected virtual void OnLeftMulticastGroup(IPAddress address) { }
650650
/// <remarks>
651651
/// Notification is called when another datagram was received from some endpoint
652652
/// </remarks>
653-
protected virtual void OnReceived(IPEndPoint endpoint, byte[] buffer, long size) { }
653+
protected virtual void OnReceived(IPEndPoint endpoint, byte[] buffer, long size) {}
654654
/// <summary>
655655
/// Handle datagram sent notification
656656
/// </summary>
@@ -660,13 +660,13 @@ protected virtual void OnReceived(IPEndPoint endpoint, byte[] buffer, long size)
660660
/// Notification is called when a datagram was sent to the server.
661661
/// This handler could be used to send another datagram to the server for instance when the pending size is zero.
662662
/// </remarks>
663-
protected virtual void OnSent(IPEndPoint endpoint, long sent) { }
663+
protected virtual void OnSent(IPEndPoint endpoint, long sent) {}
664664

665665
/// <summary>
666666
/// Handle error notification
667667
/// </summary>
668668
/// <param name="error">Socket error code</param>
669-
protected virtual void OnError(SocketError error) { }
669+
protected virtual void OnError(SocketError error) {}
670670

671671
#endregion
672672

source/NetCoreServer/UdpServer.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public virtual bool Stop()
217217
// Dispose the session socket
218218
Socket.Dispose();
219219
}
220-
catch (ObjectDisposedException) { }
220+
catch (ObjectDisposedException) {}
221221

222222
// Update the started flag
223223
IsStarted = false;
@@ -466,7 +466,7 @@ private void TryReceive()
466466
if (!Socket.ReceiveFromAsync(_receiveEventArg))
467467
ProcessReceiveFrom(_receiveEventArg);
468468
}
469-
catch (ObjectDisposedException) { }
469+
catch (ObjectDisposedException) {}
470470
}
471471

472472
/// <summary>
@@ -489,7 +489,7 @@ private void TrySend()
489489
if (!Socket.SendToAsync(_sendEventArg))
490490
ProcessSendTo(_sendEventArg);
491491
}
492-
catch (ObjectDisposedException) { }
492+
catch (ObjectDisposedException) {}
493493
}
494494

495495
/// <summary>
@@ -605,11 +605,11 @@ private void ProcessSendTo(SocketAsyncEventArgs e)
605605
/// <summary>
606606
/// Handle server started notification
607607
/// </summary>
608-
protected virtual void OnStarted() { }
608+
protected virtual void OnStarted() {}
609609
/// <summary>
610610
/// Handle server stopped notification
611611
/// </summary>
612-
protected virtual void OnStopped() { }
612+
protected virtual void OnStopped() {}
613613

614614
/// <summary>
615615
/// Handle datagram received notification
@@ -620,7 +620,7 @@ protected virtual void OnStopped() { }
620620
/// <remarks>
621621
/// Notification is called when another datagram was received from some endpoint
622622
/// </remarks>
623-
protected virtual void OnReceived(IPEndPoint endpoint, byte[] buffer, long size) { }
623+
protected virtual void OnReceived(IPEndPoint endpoint, byte[] buffer, long size) {}
624624
/// <summary>
625625
/// Handle datagram sent notification
626626
/// </summary>
@@ -630,13 +630,13 @@ protected virtual void OnReceived(IPEndPoint endpoint, byte[] buffer, long size)
630630
/// Notification is called when a datagram was sent to the client.
631631
/// This handler could be used to send another datagram to the client for instance when the pending size is zero.
632632
/// </remarks>
633-
protected virtual void OnSent(IPEndPoint endpoint, long sent) { }
633+
protected virtual void OnSent(IPEndPoint endpoint, long sent) {}
634634

635635
/// <summary>
636636
/// Handle error notification
637637
/// </summary>
638638
/// <param name="error">Socket error code</param>
639-
protected virtual void OnError(SocketError error) { }
639+
protected virtual void OnError(SocketError error) {}
640640

641641
#endregion
642642

@@ -674,16 +674,16 @@ public void Dispose()
674674

675675
protected virtual void Dispose(bool disposingManagedResources)
676676
{
677-
// The idea here is that Dispose(Boolean) knows whether it is
678-
// being called to do explicit cleanup (the Boolean is true)
679-
// versus being called due to a garbage collection (the Boolean
680-
// is false). This distinction is useful because, when being
681-
// disposed explicitly, the Dispose(Boolean) method can safely
682-
// execute code using reference type fields that refer to other
683-
// objects knowing for sure that these other objects have not been
684-
// finalized or disposed of yet. When the Boolean is false,
685-
// the Dispose(Boolean) method should not execute code that
686-
// refer to reference type fields because those objects may
677+
// The idea here is that Dispose(Boolean) knows whether it is
678+
// being called to do explicit cleanup (the Boolean is true)
679+
// versus being called due to a garbage collection (the Boolean
680+
// is false). This distinction is useful because, when being
681+
// disposed explicitly, the Dispose(Boolean) method can safely
682+
// execute code using reference type fields that refer to other
683+
// objects knowing for sure that these other objects have not been
684+
// finalized or disposed of yet. When the Boolean is false,
685+
// the Dispose(Boolean) method should not execute code that
686+
// refer to reference type fields because those objects may
687687
// have already been finalized."
688688

689689
if (!_disposed)

tests/TcpTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class EchoTcpSession : TcpSession
2727
public bool Disconnected { get; set; }
2828
public bool Errors { get; set; }
2929

30-
public EchoTcpSession(TcpServer server) : base(server) { }
30+
public EchoTcpSession(TcpServer server) : base(server) {}
3131

3232
protected override void OnConnected() { Connected = true; }
3333
protected override void OnDisconnected() { Disconnected = true; }

0 commit comments

Comments
 (0)