diff options
author | Pierre Ossman <ossman@cendio.se> | 2016-12-29 16:52:56 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-01-03 13:50:32 +0100 |
commit | 9a73adf9f47c8fab82add168bf7f50b7fe6ef2a3 (patch) | |
tree | 05e544e214d33e19a0ddfd29008fd891b271e77c /vncviewer | |
parent | a432b58232cbe576b7776b674eb8da368c47ce7a (diff) | |
download | tigervnc-9a73adf9f47c8fab82add168bf7f50b7fe6ef2a3.tar.gz tigervnc-9a73adf9f47c8fab82add168bf7f50b7fe6ef2a3.zip |
More robust event and close handling
There were still some circumstances where we could get stuck reading
data and not respect close events properly. Move that logic to a more
central place in order to make it more reliable.
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/CConn.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 140b1d65..baf01d41 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -254,6 +254,15 @@ void CConn::socketEvent(FL_SOCKET fd, void *data) // until the buffers are empty or things will stall. do { cc->processMsg(); + + // Make sure that the FLTK handling and the timers gets some CPU + // time in case of back to back messages + Fl::check(); + Timer::checkTimeouts(); + + // Also check if we need to stop reading and terminate + if (should_exit()) + break; } while (cc->sock->inStream().checkNoWait(1)); } catch (rdr::EndOfStream& e) { vlog.info("%s", e.str()); @@ -397,11 +406,6 @@ void CConn::framebufferUpdateEnd() // Compute new settings based on updated bandwidth values if (autoSelect) autoSelectFormatAndEncoding(); - - // Make sure that the FLTK handling and the timers gets some CPU time - // in case of back to back framebuffer updates. - Fl::check(); - Timer::checkTimeouts(); } // The rest of the callbacks are fairly self-explanatory... |