Disabled reconnect after fingerprint failed #4527
This commit is contained in:
parent
365d16c94b
commit
e6e3eae0a9
|
@ -95,6 +95,7 @@ REGISTER_EVENT(IListenSocket, connecting)
|
|||
//
|
||||
|
||||
REGISTER_EVENT(ISocket, disconnected)
|
||||
REGISTER_EVENT(ISocket, stopRetry)
|
||||
|
||||
//
|
||||
// OSXScreen
|
||||
|
|
|
@ -281,7 +281,8 @@ private:
|
|||
class ISocketEvents : public EventTypes {
|
||||
public:
|
||||
ISocketEvents() :
|
||||
m_disconnected(Event::kUnknown) { }
|
||||
m_disconnected(Event::kUnknown),
|
||||
m_stopRetry(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
@ -294,10 +295,18 @@ public:
|
|||
*/
|
||||
Event::Type disconnected();
|
||||
|
||||
//! Get stop retry event type
|
||||
/*!
|
||||
Returns the stop retry event type. This is sent when the client
|
||||
doesn't want to reconnect after it disconnects from the server.
|
||||
*/
|
||||
Event::Type stopRetry();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
Event::Type m_disconnected;
|
||||
Event::Type m_stopRetry;
|
||||
};
|
||||
|
||||
class OSXScreenEvents : public EventTypes {
|
||||
|
|
|
@ -60,7 +60,7 @@ Client::Client(
|
|||
const String& name, const NetworkAddress& address,
|
||||
ISocketFactory* socketFactory,
|
||||
synergy::Screen* screen,
|
||||
ClientArgs args) :
|
||||
ClientArgs& args) :
|
||||
m_mock(false),
|
||||
m_name(name),
|
||||
m_serverAddress(address),
|
||||
|
@ -470,6 +470,10 @@ Client::setupConnection()
|
|||
m_stream->getEventTarget(),
|
||||
new TMethodEventJob<Client>(this,
|
||||
&Client::handleDisconnected));
|
||||
|
||||
m_events->adoptHandler(m_events->forISocket().stopRetry(),
|
||||
m_stream->getEventTarget(),
|
||||
new TMethodEventJob<Client>(this, &Client::handleStopRetry));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -525,6 +529,8 @@ Client::cleanupConnection()
|
|||
m_stream->getEventTarget());
|
||||
m_events->removeHandler(m_events->forISocket().disconnected(),
|
||||
m_stream->getEventTarget());
|
||||
m_events->removeHandler(m_events->forISocket().stopRetry(),
|
||||
m_stream->getEventTarget());
|
||||
cleanupStream();
|
||||
}
|
||||
}
|
||||
|
@ -743,6 +749,11 @@ Client::onFileRecieveCompleted()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Client::handleStopRetry(const Event&, void*)
|
||||
{
|
||||
m_args.m_restartable = false;
|
||||
}
|
||||
|
||||
void
|
||||
Client::writeToDropDirThread(void*)
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
const String& name, const NetworkAddress& address,
|
||||
ISocketFactory* socketFactory,
|
||||
synergy::Screen* screen,
|
||||
ClientArgs args);
|
||||
ClientArgs& args);
|
||||
~Client();
|
||||
|
||||
#ifdef TEST_ENV
|
||||
|
@ -196,6 +196,7 @@ private:
|
|||
void handleResume(const Event& event, void*);
|
||||
void handleFileChunkSending(const Event&, void*);
|
||||
void handleFileRecieveCompleted(const Event&, void*);
|
||||
void handleStopRetry(const Event&, void*);
|
||||
void onFileRecieveCompleted();
|
||||
|
||||
public:
|
||||
|
@ -226,5 +227,5 @@ private:
|
|||
Thread* m_writeToDropDirThread;
|
||||
TCPSocket* m_socket;
|
||||
bool m_useSecureNetwork;
|
||||
ClientArgs m_args;
|
||||
ClientArgs& m_args;
|
||||
};
|
||||
|
|
|
@ -281,10 +281,8 @@ SecureSocket::secureConnect(int socket)
|
|||
checkResult(r, fatal, retry);
|
||||
|
||||
if (fatal) {
|
||||
// tell user and sleep so the socket isn't hammered.
|
||||
LOG((CLOG_ERR "failed to connect secure socket"));
|
||||
LOG((CLOG_INFO "server connection may not be secure"));
|
||||
disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -299,6 +297,7 @@ SecureSocket::secureConnect(int socket)
|
|||
}
|
||||
else {
|
||||
LOG((CLOG_ERR "failed to verify server certificate fingerprint"));
|
||||
sendEvent(getEvents()->forISocket().stopRetry());
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,7 +331,6 @@ ClientApp::handleClientDisconnected(const Event&, void*)
|
|||
updateStatus();
|
||||
}
|
||||
|
||||
|
||||
Client*
|
||||
ClientApp::openClient(const String& name, const NetworkAddress& address,
|
||||
synergy::Screen* screen)
|
||||
|
|
Loading…
Reference in New Issue