Terminate the viewer even when waiting for data
It should be possible to exit the viewer even if the network has
stalled in the middle of a transfer.
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 2acb373..686ce30 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -240,6 +240,9 @@
next_timer = INT_MAX;
Fl::wait((double)next_timer / 1000.0);
+
+ if (should_exit())
+ throw rdr::Exception("Termination requested");
}
void CConn::socketEvent(FL_SOCKET fd, void *data)
@@ -267,7 +270,10 @@
exit_vncviewer();
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ // Somebody might already have requested us to terminate, and
+ // might have already provided an error message.
+ if (!should_exit())
+ exit_vncviewer(e.str());
}
recursing = false;