Menu

#1578 tvnserver stop takes about 2 minutes if some clients are connected

open
nobody
None
2
2022-02-15
2022-02-15
JPDelprat
No

Under Windows 10

If I try to start tvnserver whereas a client is connected, it takes a long time (about 2 minutes).

The problem is in the RfbClient::disconnect method, which calls :

  • m_socket ->shutdown(SD_BOTH) => shutdown underlying real socket (m_socket is SocketIPV4 object).
  • m_socket->close() => only set a m_closed boolean variable.

The application is blocked for 2 minutes in the RfbDispatcher::execute() method, in m_gate->read call, which calls recv on the client socket.

Problem is the following one :

  • shutdown doesn't interrupt recv
  • close as no effect (only set a variable).

If I call closesocket instead, it unblocks the recv call, but I have no mean to do this without modifying your code.
Moreover, if I call closesocket on the socket wrapped by IPSocketV4, IPSocketV4 should be deleted in your logic.

Thanks

Discussion


Log in to post a comment.

MongoDB Logo MongoDB