THRIFT-904: disable nagle and linger
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1063966 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/csharp/ThriftTest/TestServer.cs b/test/csharp/ThriftTest/TestServer.cs
index e370640..894ec9c 100644
--- a/test/csharp/ThriftTest/TestServer.cs
+++ b/test/csharp/ThriftTest/TestServer.cs
@@ -301,7 +301,7 @@
{
try
{
- bool useBufferedSockets = false;
+ bool useBufferedSockets = false, useFramed = false;
int port = 9090;
if (args.Length > 0)
{
@@ -309,7 +309,23 @@
if (args.Length > 1)
{
- bool.TryParse(args[1], out useBufferedSockets);
+ if ( args[1] == "raw" )
+ {
+ // as default
+ }
+ else if ( args[1] == "buffered" )
+ {
+ useBufferedSockets = true;
+ }
+ else if ( args[1] == "framed" )
+ {
+ useFramed = true;
+ }
+ else
+ {
+ // Fall back to the older boolean syntax
+ bool.TryParse(args[1], out useBufferedSockets);
+ }
}
}
@@ -320,10 +336,12 @@
// Transport
TServerSocket tServerSocket = new TServerSocket(port, 0, useBufferedSockets);
- TServer serverEngine;
-
// Simple Server
- serverEngine = new TSimpleServer(testProcessor, tServerSocket);
+ TServer serverEngine;
+ if ( useFramed )
+ serverEngine = new TSimpleServer(testProcessor, tServerSocket, new TFramedTransport.Factory());
+ else
+ serverEngine = new TSimpleServer(testProcessor, tServerSocket);
// ThreadPool Server
// serverEngine = new TThreadPoolServer(testProcessor, tServerSocket);
@@ -334,7 +352,10 @@
testHandler.server = serverEngine;
// Run it
- Console.WriteLine("Starting the server on port " + port + (useBufferedSockets ? " with buffered socket" : "") + "...");
+ Console.WriteLine("Starting the server on port " + port +
+ (useBufferedSockets ? " with buffered socket" : "") +
+ (useFramed ? " with framed transport" : "") +
+ "...");
serverEngine.Serve();
}