[
https://issues.apache.org/jira/browse/THRIFT-4500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer updated THRIFT-4500:
-------------------------------
Component/s: netstd - Library
(was: C# - Library)
> Unable to stop socket server while there are connected clients
> --------------------------------------------------------------
>
> Key: THRIFT-4500
> URL: https://issues.apache.org/jira/browse/THRIFT-4500
> Project: Thrift
> Issue Type: Bug
> Components: netstd - Library
> Affects Versions: 0.11.0
> Reporter: Gianni Ambrosio
> Priority: Major
>
> I implemented a thrift server with TSimpleServer in a C# application:
>
> public class ThriftServer
> {
> public void start(){
> Service.Processor processor = new Service.Processor(serviceHandler);
> TServerSocket serverTransport = new
> TServerSocket(ServiceConstants.ServicePort);
> server = new TSimpleServer(processor, serverTransport);
> workerThread = new Thread(new ThreadStart(run));
> workerThread.Start();
> }
> private void run(){
> server.Serve();
> }
> public void stop(){
> server.Stop();
> }
> }
> Moreover I implemented a C++ application for the thrift client.
> When a client is connected to the C# server, there's no way to exit the C#
> application. In fact server.Server() is blocked and server.Stop() does
> nothing to make the Serve() call exiting.
> If I close the C++ application (so the related thrift client) the
> server.Serve() call returns immediately and the C# application ends.
> In release 0.11.0 the blocking call is at line 137 of TSimpleServer.cs:
> if (!inputTransport.Peek())
> Following implementation is useless in this case.
> public override void Stop()
> {
> stop = true;
> serverTransport.Close();
> }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)