THRIFT-2952 Improve handling of Server.Stop()
Client: C#
Patch: Jens Geyer
This closes #361
diff --git a/lib/csharp/src/Server/TSimpleServer.cs b/lib/csharp/src/Server/TSimpleServer.cs
index 36bbe9d..267b470 100644
--- a/lib/csharp/src/Server/TSimpleServer.cs
+++ b/lib/csharp/src/Server/TSimpleServer.cs
@@ -116,7 +116,7 @@
connectionContext = serverEventHandler.createContext(inputProtocol, outputProtocol);
//Process client requests until client disconnects
- while (true)
+ while (!stop)
{
if (!inputTransport.Peek())
break;
@@ -136,9 +136,12 @@
}
}
}
- catch (TTransportException)
+ catch (TTransportException ttx)
{
- //Usually a client disconnect, expected
+ if (!stop || ttx.Type != TTransportException.ExceptionType.Interrupted)
+ {
+ logDelegate(ttx.ToString());
+ }
}
catch (Exception x)
{