Browse Source

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
tags/v1.2.90
Pierre Ossman 12 years ago
parent
commit
b8b1e96d83
2 changed files with 10 additions and 6 deletions
  1. 9
    5
      common/rfb/VNCSConnectionST.cxx
  2. 1
    1
      common/rfb/VNCSConnectionST.h

+ 9
- 5
common/rfb/VNCSConnectionST.cxx View File

@@ -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;

+ 1
- 1
common/rfb/VNCSConnectionST.h View File

@@ -183,7 +183,7 @@ namespace rfb {

bool inProcessMessages;

bool syncFence;
bool pendingSyncFence, syncFence;
rdr::U32 fenceFlags;
unsigned fenceDataLen;
char *fenceData;

Loading…
Cancel
Save