From e15038f3ec77bfd54e1f7046987067777d544d9c Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Wed, 21 Sep 2016 21:23:06 -0500 Subject: [PATCH] Avoid long hangs on disconnect if the connection is disrupted. --- vncsession.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vncsession.cc b/vncsession.cc index 6eeca68..59f0b9d 100644 --- a/vncsession.cc +++ b/vncsession.cc @@ -670,10 +670,15 @@ void UnTuneMarinetti (void) { * CloseTCPConnection() - Close the TCP connection to the host **********************************************************************/ void CloseTCPConnection (void) { + long stopTime; + TCPIPCloseTCP(hostIpid); WaitCursor(); DisplayConnectStatus("\pClosing VNC session...", FALSE); + stopTime = TickCount() + 5 * 60; do { + if (TickCount() >= stopTime) + TCPIPAbortTCP(hostIpid); TCPIPPoll(); TCPIPLogout(hostIpid); } while (toolerror() == terrSOCKETOPEN);