Server implementation of continuous updates, including advanced flow control.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4803 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h
index e06522b..8742fa6 100644
--- a/common/rfb/VNCSConnectionST.h
+++ b/common/rfb/VNCSConnectionST.h
@@ -34,6 +34,8 @@
 #include <rfb/VNCServerST.h>
 #include <rfb/Timer.h>
 
+struct RTTInfo;
+
 namespace rfb {
   class VNCSConnectionST : public SConnection,
                            public WriteSetCursorCallback,
@@ -134,8 +136,11 @@
                                 const ScreenSet& layout);
     virtual void setInitialColourMap();
     virtual void fence(rdr::U32 flags, unsigned len, const char data[]);
+    virtual void enableContinuousUpdates(bool enable,
+                                         int x, int y, int w, int h);
     virtual void supportsLocalCursor();
     virtual void supportsFence();
+    virtual void supportsContinuousUpdates();
 
     // setAccessRights() allows a security package to limit the access rights
     // of a VNCSConnectioST to the server.  These access rights are applied
@@ -151,7 +156,11 @@
 
     // Internal methods
 
+    // Congestion control
+    void writeRTTPing();
+    void handleRTTPong(const struct RTTInfo &rttInfo);
     bool isCongested();
+    void updateCongestion();
 
     // writeFramebufferUpdate() attempts to write a framebuffer update to the
     // client.
@@ -175,12 +184,23 @@
     unsigned fenceDataLen;
     char *fenceData;
 
+    unsigned baseRTT;
+    unsigned congWindow;
+    int ackedOffset, sentOffset;
+
+    unsigned minRTT;
+    bool seenCongestion;
+    unsigned pingCounter;
+    Timer congestionTimer;
+
     VNCServerST* server;
     SimpleUpdateTracker updates;
     TransImageGetter image_getter;
     Region requested;
     bool drawRenderedCursor, removeRenderedCursor;
     Rect renderedCursorRect;
+    bool continuousUpdates;
+    Region cuRegion;
 
     Timer updateTimer;