("QueryConnect",
"Prompt the local user to accept or reject incoming connections.",
false);
-rfb::IntParameter rfb::Server::queryConnectTimeout
-("QueryConnectTimeout",
- "Number of seconds to show the Accept Connection dialog before "
- "rejecting the connection",
- 10);
static BoolParameter sendCutText;
static BoolParameter acceptSetDesktopSize;
static BoolParameter queryConnect;
- static IntParameter queryConnectTimeout;
};
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),
CharArray reason;
VNCServerST::queryResult qr = server->queryConnection(sock, userName,
&reason.buf);
- if (qr == VNCServerST::PENDING) {
- queryConnectTimer.start(rfb::Server::queryConnectTimeout * 1000);
+ if (qr == VNCServerST::PENDING)
return;
- }
// - If server returns ACCEPT/REJECT then pass result to SConnection
approveConnection(qr == VNCServerST::ACCEPT, reason.buf);
try {
if (t == &congestionTimer)
updateCongestion();
- else if (t == &queryConnectTimer) {
- if (state() == RFBSTATE_QUERYING)
- approveConnection(false, "The attempt to prompt the user to accept the connection failed");
- }
} catch (rdr::Exception& e) {
close(e.str());
}
CharArray peerEndpoint;
bool reverseConnection;
- Timer queryConnectTimer;
-
bool inProcessMessages;
bool pendingSyncFence, syncFence;
"Send keyboard events straight through and "
"avoid mapping them to the current keyboard "
"layout", false);
+IntParameter queryConnectTimeout("QueryConnectTimeout",
+ "Number of seconds to show the "
+ "Accept Connection dialog before "
+ "rejecting the connection",
+ 10);
class FileHTTPServer : public rfb::HTTPServer {
public:
server(0), httpServer(0),
listeners(listeners_), httpListeners(httpListeners_),
directFbptr(true),
- queryConnectId(0)
+ queryConnectId(0), queryConnectTimer(this)
{
format = pf;
{
int count;
- if (queryConnectId) {
+ if (queryConnectTimer.isStarted()) {
*reason = strDup("Another connection is currently being queried.");
return rfb::VNCServerST::REJECT;
}
queryConnectId = (uint32_t)(intptr_t)sock;
queryConnectSocket = sock;
+ queryConnectTimer.start(queryConnectTimeout * 1000);
+
return rfb::VNCServerST::PENDING;
}
{
*opaqueId = queryConnectId;
- if (queryConnectId == 0) {
+ if (!queryConnectTimer.isStarted()) {
*address = "";
*username = "";
*timeout = 0;
} else {
*address = queryConnectAddress.buf;
*username = queryConnectUsername.buf;
- *timeout = rfb::Server::queryConnectTimeout;
+ *timeout = queryConnectTimeout;
}
}
if (queryConnectId == opaqueId) {
server->approveConnection(queryConnectSocket, accept, rejectMsg);
queryConnectId = 0;
+ queryConnectTimer.stop();
}
}
vncKeyboardEvent(keysym, keycode, down);
}
+
+bool XserverDesktop::handleTimeout(Timer* t)
+{
+ if (t == &queryConnectTimer) {
+ server->approveConnection(queryConnectSocket, false,
+ "The attempt to prompt the user to "
+ "accept the connection failed");
+ }
+
+ return false;
+}
class XserverDesktop : public rfb::SDesktop, public rfb::FullFramePixelBuffer,
public rdr::Substitutor,
- public rfb::VNCServerST::QueryConnectionHandler {
+ public rfb::VNCServerST::QueryConnectionHandler,
+ public rfb::Timer::Callback {
public:
XserverDesktop(int screenIndex,
network::SocketServer* sockserv,
bool read, bool write);
+ virtual bool handleTimeout(rfb::Timer* t);
+
private:
rfb::ScreenSet computeScreenLayout();
network::Socket* queryConnectSocket;
rfb::CharArray queryConnectAddress;
rfb::CharArray queryConnectUsername;
+ rfb::Timer queryConnectTimer;
#ifdef RANDR
typedef std::map<intptr_t, rdr::U32> OutputIdMap;