* USA.
*/
- // Debug output on what the congestion control is up to
- #undef CONGESTION_DEBUG
-
- #include <sys/time.h>
-
- #ifdef CONGESTION_DEBUG
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netinet/tcp.h>
- #endif
-
#include <network/TcpSocket.h>
- #include <rfb/VNCSConnectionST.h>
+
+ #include <rfb/ComparingUpdateTracker.h>
+ #include <rfb/Encoder.h>
+ #include <rfb/KeyRemapper.h>
#include <rfb/LogWriter.h>
#include <rfb/Security.h>
+ #include <rfb/ServerCore.h>
+ #include <rfb/SMsgWriter.h>
+ #include <rfb/VNCServerST.h>
+ #include <rfb/VNCSConnectionST.h>
#include <rfb/screenTypes.h>
#include <rfb/fenceTypes.h>
- #include <rfb/ServerCore.h>
- #include <rfb/ComparingUpdateTracker.h>
- #include <rfb/KeyRemapper.h>
- #include <rfb/Encoder.h>
+#include <rfb/ledStates.h>
+#define XK_LATIN1
#define XK_MISCELLANY
#define XK_XKB_KEYS
#include <rfb/keysymdef.h>
static LogWriter vlog("VNCSConnST");
- // This window should get us going fairly fast on a decent bandwidth network.
- // If it's too high, it will rapidly be reduced and stay low.
- static const unsigned INITIAL_WINDOW = 16384;
-
- // TCP's minimal window is 3*MSS. But since we don't know the MSS, we
- // make a guess at 4 KiB (it's probably a bit higher).
- static const unsigned MINIMUM_WINDOW = 4096;
-
- // The current default maximum window for Linux (4 MiB). Should be a good
- // limit for now...
- static const unsigned MAXIMUM_WINDOW = 4194304;
-
- struct RTTInfo {
- struct timeval tv;
- int offset;
- unsigned inFlight;
- };
-
+static Cursor emptyCursor(0, 0, Point(0, 0), NULL);
+
VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s,
bool reverse)
: sock(s), reverseConnection(reverse),
- queryConnectTimer(this), inProcessMessages(false),
+ inProcessMessages(false),
pendingSyncFence(false), syncFence(false), fenceFlags(0),
- fenceDataLen(0), fenceData(NULL),
- baseRTT(-1), congWindow(0), ackedOffset(0), sentOffset(0),
- minRTT(-1), seenCongestion(false),
- pingCounter(0), congestionTimer(this),
+ fenceDataLen(0), fenceData(NULL), congestionTimer(this),
server(server_), updates(false),
updateRenderedCursor(false), removeRenderedCursor(false),
continuousUpdates(false), encodeManager(this), pointerEventTime(0),
bool VNCSConnectionST::handleTimeout(Timer* t)
{
try {
- if (t == &queryConnectTimer) {
- if (state() == RFBSTATE_QUERYING)
- approveConnection(false, "The attempt to prompt the user to accept the connection failed");
- } else if (t == &congestionTimer) {
+ if (t == &congestionTimer)
- updateCongestion();
+ writeFramebufferUpdate();
- }
} catch (rdr::Exception& e) {
close(e.str());
}
// Then real data (if possible)
writeDataUpdate();
- network::TcpSocket::cork(sock->getFd(), false);
+ sock->cork(false);
+
+ congestion.updatePosition(sock->outStream().length());
}
void VNCSConnectionST::writeNoDataUpdate()