diff options
author | Pierre Ossman <ossman@cendio.se> | 2012-07-20 10:47:00 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2012-07-20 10:47:00 +0000 |
commit | b8b1e96d837bf50b8a0f50f68bcd098eb999eec2 (patch) | |
tree | 3e8552501246d6a4fe8338fa7c9a31aa1bf002f2 /common | |
parent | 229229648fa3c2e035306d1845a20c9240b1a383 (diff) | |
download | tigervnc-b8b1e96d837bf50b8a0f50f68bcd098eb999eec2.tar.gz tigervnc-b8b1e96d837bf50b8a0f50f68bcd098eb999eec2.zip |
We were not handling the "sync next" fence properly as we sent the response
right after we got the request (instead of waiting for the next command).
This created a race where we could lose pixel format sync between the client
and the server.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4943 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common')
-rw-r--r-- | common/rfb/VNCSConnectionST.cxx | 14 | ||||
-rw-r--r-- | common/rfb/VNCSConnectionST.h | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 1ecd78c2..381ee216 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -66,7 +66,8 @@ struct RTTInfo { VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s, bool reverse) : SConnection(reverse), sock(s), inProcessMessages(false), - syncFence(false), fenceFlags(0), fenceDataLen(0), fenceData(NULL), + pendingSyncFence(false), syncFence(false), fenceFlags(0), + fenceDataLen(0), fenceData(NULL), baseRTT(-1), minRTT(-1), seenCongestion(false), pingCounter(0), ackedOffset(0), sentOffset(0), congWindow(0), congestionTimer(this), server(server_), @@ -156,7 +157,13 @@ void VNCSConnectionST::processMessages() network::TcpSocket::cork(sock->getFd(), true); while (getInStream()->checkNoWait(1)) { + if (pendingSyncFence) { + syncFence = true; + pendingSyncFence = false; + } + processMsg(); + if (syncFence) { writer()->writeFence(fenceFlags, fenceDataLen, fenceData); syncFence = false; @@ -627,10 +634,7 @@ void VNCSConnectionST::fence(rdr::U32 flags, unsigned len, const char data[]) { if (flags & fenceFlagRequest) { if (flags & fenceFlagSyncNext) { - if (syncFence) - vlog.error("Fence trying to synchronise another fence"); - - syncFence = true; + pendingSyncFence = true; fenceFlags = flags & (fenceFlagBlockBefore | fenceFlagBlockAfter | fenceFlagSyncNext); fenceDataLen = len; diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h index 72dc59c0..5eb908ab 100644 --- a/common/rfb/VNCSConnectionST.h +++ b/common/rfb/VNCSConnectionST.h @@ -183,7 +183,7 @@ namespace rfb { bool inProcessMessages; - bool syncFence; + bool pendingSyncFence, syncFence; rdr::U32 fenceFlags; unsigned fenceDataLen; char *fenceData; |