THRIFT-4535: XML docs; code cleanup (tabs->spaces; String->string)
Client: C#
Patch: Christian Weiss
This closes #1524
diff --git a/lib/csharp/src/Transport/TServerSocket.cs b/lib/csharp/src/Transport/TServerSocket.cs
index e29a87e..40e47dc 100644
--- a/lib/csharp/src/Transport/TServerSocket.cs
+++ b/lib/csharp/src/Transport/TServerSocket.cs
@@ -27,150 +27,150 @@
namespace Thrift.Transport
{
- public class TServerSocket : TServerTransport
- {
- /**
- * Underlying server with socket
- */
- private TcpListener server = null;
+ public class TServerSocket : TServerTransport
+ {
+ /// <summary>
+ /// Underlying server with socket.
+ /// </summary>
+ private TcpListener server = null;
- /**
- * Port to listen on
- */
- private int port = 0;
+ /// <summary>
+ /// Port to listen on.
+ /// </summary>
+ private int port = 0;
- /**
- * Timeout for client sockets from accept
- */
- private int clientTimeout = 0;
+ /// <summary>
+ /// Timeout for client sockets from accept.
+ /// </summary>
+ private int clientTimeout = 0;
- /**
- * Whether or not to wrap new TSocket connections in buffers
- */
- private bool useBufferedSockets = false;
+ /// <summary>
+ /// Whether or not to wrap new TSocket connections in buffers.
+ /// </summary>
+ private bool useBufferedSockets = false;
- /**
- * Creates a server socket from underlying socket object
- */
- public TServerSocket(TcpListener listener)
- :this(listener, 0)
- {
- }
+ /// <summary>
+ /// Creates a server socket from underlying socket object.
+ /// </summary>
+ public TServerSocket(TcpListener listener)
+ : this(listener, 0)
+ {
+ }
- /**
- * Creates a server socket from underlying socket object
- */
- public TServerSocket(TcpListener listener, int clientTimeout)
- {
- this.server = listener;
- this.clientTimeout = clientTimeout;
- }
+ /// <summary>
+ /// Creates a server socket from underlying socket object.
+ /// </summary>
+ public TServerSocket(TcpListener listener, int clientTimeout)
+ {
+ this.server = listener;
+ this.clientTimeout = clientTimeout;
+ }
- /**
- * Creates just a port listening server socket
- */
- public TServerSocket(int port)
- : this(port, 0)
- {
- }
+ /// <summary>
+ /// Creates just a port listening server socket.
+ /// </summary>
+ public TServerSocket(int port)
+ : this(port, 0)
+ {
+ }
- /**
- * Creates just a port listening server socket
- */
- public TServerSocket(int port, int clientTimeout)
- :this(port, clientTimeout, false)
- {
- }
+ /// <summary>
+ /// Creates just a port listening server socket.
+ /// </summary>
+ public TServerSocket(int port, int clientTimeout)
+ : this(port, clientTimeout, false)
+ {
+ }
- public TServerSocket(int port, int clientTimeout, bool useBufferedSockets)
- {
- this.port = port;
- this.clientTimeout = clientTimeout;
- this.useBufferedSockets = useBufferedSockets;
- try
- {
- // Make server socket
- this.server = TSocketVersionizer.CreateTcpListener(this.port);
- this.server.Server.NoDelay = true;
- }
- catch (Exception)
- {
- server = null;
- throw new TTransportException("Could not create ServerSocket on port " + this.port + ".");
- }
- }
+ public TServerSocket(int port, int clientTimeout, bool useBufferedSockets)
+ {
+ this.port = port;
+ this.clientTimeout = clientTimeout;
+ this.useBufferedSockets = useBufferedSockets;
+ try
+ {
+ // Make server socket
+ this.server = TSocketVersionizer.CreateTcpListener(this.port);
+ this.server.Server.NoDelay = true;
+ }
+ catch (Exception)
+ {
+ server = null;
+ throw new TTransportException("Could not create ServerSocket on port " + this.port + ".");
+ }
+ }
- public override void Listen()
- {
- // Make sure not to block on accept
- if (server != null)
- {
- try
- {
- server.Start();
- }
- catch (SocketException sx)
- {
- throw new TTransportException("Could not accept on listening socket: " + sx.Message);
- }
- }
- }
+ public override void Listen()
+ {
+ // Make sure not to block on accept
+ if (server != null)
+ {
+ try
+ {
+ server.Start();
+ }
+ catch (SocketException sx)
+ {
+ throw new TTransportException("Could not accept on listening socket: " + sx.Message);
+ }
+ }
+ }
- protected override TTransport AcceptImpl()
- {
- if (server == null)
- {
- throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
- }
- try
- {
- TSocket result2 = null;
- TcpClient result = server.AcceptTcpClient();
- try
- {
- result2 = new TSocket(result);
- result2.Timeout = clientTimeout;
- if (useBufferedSockets)
- {
- TBufferedTransport result3 = new TBufferedTransport(result2);
- return result3;
- }
- else
- {
- return result2;
- }
- }
- catch (System.Exception)
- {
- // If a TSocket was successfully created, then let
- // it do proper cleanup of the TcpClient object.
- if (result2 != null)
- result2.Dispose();
- else // Otherwise, clean it up ourselves.
- ((IDisposable)result).Dispose();
- throw;
- }
- }
- catch (Exception ex)
- {
- throw new TTransportException(ex.ToString());
- }
- }
+ protected override TTransport AcceptImpl()
+ {
+ if (server == null)
+ {
+ throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
+ }
+ try
+ {
+ TSocket result2 = null;
+ TcpClient result = server.AcceptTcpClient();
+ try
+ {
+ result2 = new TSocket(result);
+ result2.Timeout = clientTimeout;
+ if (useBufferedSockets)
+ {
+ TBufferedTransport result3 = new TBufferedTransport(result2);
+ return result3;
+ }
+ else
+ {
+ return result2;
+ }
+ }
+ catch (System.Exception)
+ {
+ // If a TSocket was successfully created, then let
+ // it do proper cleanup of the TcpClient object.
+ if (result2 != null)
+ result2.Dispose();
+ else // Otherwise, clean it up ourselves.
+ ((IDisposable)result).Dispose();
+ throw;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new TTransportException(ex.ToString());
+ }
+ }
- public override void Close()
- {
- if (server != null)
- {
- try
- {
- server.Stop();
- }
- catch (Exception ex)
- {
- throw new TTransportException("WARNING: Could not close server socket: " + ex);
- }
- server = null;
- }
- }
- }
+ public override void Close()
+ {
+ if (server != null)
+ {
+ try
+ {
+ server.Stop();
+ }
+ catch (Exception ex)
+ {
+ throw new TTransportException("WARNING: Could not close server socket: " + ex);
+ }
+ server = null;
+ }
+ }
+ }
}