Kaynağa Gözat

VNCServerST: Add a timeout to pointer button ownership

When one clients holds down a button on the pointer device (probably
dragging something), other clients' attempts at pointer operations
are denied. This yields a sane user experience, but with limits.

When one clients starts dragging, and then his network connection fails,
other clients are denied access to the pointer until the VNC server
finally discovers that the connection is dead and closes it. This can
take about 15 minutes.

Add a timeout to this policy: If we don't hear from the client for 3
seconds, other clients are allowed to control the pointer once more.

This solves the problem that one failing network could make the server
completely deaf to other clients for a long time.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
pull/1718/head
Mike Looijmans 4 ay önce
ebeveyn
işleme
71c83b4793
2 değiştirilmiş dosya ile 8 ekleme ve 2 silme
  1. 6
    2
      common/rfb/VNCServerST.cxx
  2. 2
    0
      common/rfb/VNCServerST.h

+ 6
- 2
common/rfb/VNCServerST.cxx Dosyayı Görüntüle

: blHosts(&blacklist), desktop(desktop_), desktopStarted(false), : blHosts(&blacklist), desktop(desktop_), desktopStarted(false),
blockCounter(0), pb(0), ledState(ledUnknown), blockCounter(0), pb(0), ledState(ledUnknown),
name(name_), pointerClient(0), clipboardClient(0), name(name_), pointerClient(0), clipboardClient(0),
pointerClientTime(0),
comparer(0), cursor(new Cursor(0, 0, Point(), NULL)), comparer(0), cursor(new Cursor(0, 0, Point(), NULL)),
renderedCursorInvalid(false), renderedCursorInvalid(false),
keyRemapper(&KeyRemapper::defInstance), keyRemapper(&KeyRemapper::defInstance),
void VNCServerST::pointerEvent(VNCSConnectionST* client, void VNCServerST::pointerEvent(VNCSConnectionST* client,
const Point& pos, int buttonMask) const Point& pos, int buttonMask)
{ {
time_t now = time(0);
if (rfb::Server::maxIdleTime) if (rfb::Server::maxIdleTime)
idleTimer.start(secsToMillis(rfb::Server::maxIdleTime)); idleTimer.start(secsToMillis(rfb::Server::maxIdleTime));


// Let one client own the cursor whilst buttons are pressed in order // Let one client own the cursor whilst buttons are pressed in order
// to provide a bit more sane user experience
if ((pointerClient != NULL) && (pointerClient != client))
// to provide a bit more sane user experience. But limit the time to prevent
// locking out all others when e.g. the network is down.
if ((pointerClient != NULL) && (pointerClient != client) && ((now - pointerClientTime) < 3))
return; return;


pointerClientTime = now;
if (buttonMask) if (buttonMask)
pointerClient = client; pointerClient = client;
else else

+ 2
- 0
common/rfb/VNCServerST.h Dosyayı Görüntüle

std::list<VNCSConnectionST*> clipboardRequestors; std::list<VNCSConnectionST*> clipboardRequestors;
std::list<network::Socket*> closingSockets; std::list<network::Socket*> closingSockets;


time_t pointerClientTime;

ComparingUpdateTracker* comparer; ComparingUpdateTracker* comparer;


Point cursorPos; Point cursorPos;

Loading…
İptal
Kaydet