THRIFT-4821 Normalized the constructors in TServerSocketTransport to allow parity between the TcpListerer and port options.
Client: netstd
Patch: Kyle Smith
This closes #1758
diff --git a/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs b/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
index 710dedf..bc06640 100644
--- a/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
@@ -28,47 +28,27 @@
public class TServerSocketTransport : TServerTransport
{
private readonly int _clientTimeout;
- private readonly int _port;
private readonly bool _useBufferedSockets;
private readonly bool _useFramedTransport;
private TcpListener _server;
- public TServerSocketTransport(TcpListener listener)
- : this(listener, 0)
- {
- }
-
- public TServerSocketTransport(TcpListener listener, int clientTimeout)
+ public TServerSocketTransport(TcpListener listener, int clientTimeout = 0, bool useBufferedSockets = false, bool useFramedTransport = false)
{
_server = listener;
_clientTimeout = clientTimeout;
+ _useBufferedSockets = useBufferedSockets;
+ _useFramedTransport = useFramedTransport;
}
- public TServerSocketTransport(int port)
- : this(port, 0)
+ public TServerSocketTransport(int port, int clientTimeout = 0, bool useBufferedSockets = false, bool useFramedTransport = false)
{
- }
-
- public TServerSocketTransport(int port, int clientTimeout)
- : this(port, clientTimeout, false)
- {
- }
-
- public TServerSocketTransport(int port, int clientTimeout, bool useBufferedSockets):
- this(port, clientTimeout, useBufferedSockets, false)
- {
- }
-
- public TServerSocketTransport(int port, int clientTimeout, bool useBufferedSockets, bool useFramedTransport)
- {
- _port = port;
_clientTimeout = clientTimeout;
_useBufferedSockets = useBufferedSockets;
_useFramedTransport = useFramedTransport;
try
{
// Make server socket
- _server = new TcpListener(IPAddress.Any, _port);
+ _server = new TcpListener(IPAddress.Any, port);
_server.Server.NoDelay = true;
}
catch (Exception)
@@ -171,4 +151,4 @@
}
}
}
-}
\ No newline at end of file
+}