mirror of
https://github.com/debauchee/barrier.git
synced 2026-07-07 20:38:57 +08:00
Made socket self-aware of when it is in a fatal state #4697
Added code to cleanly terminate connection on fatal socket state #4697
This commit is contained in:
@@ -142,26 +142,34 @@ ClientListener::handleClientConnecting(const Event&, void*)
|
||||
{
|
||||
// accept client connection
|
||||
IDataSocket* socket = m_listen->accept();
|
||||
synergy::IStream* stream = socket;
|
||||
|
||||
if (stream == NULL) {
|
||||
if (socket == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG((CLOG_NOTE "accepted client connection"));
|
||||
|
||||
if (m_useSecureNetwork) {
|
||||
LOG((CLOG_DEBUG2 "attempting sercure Connection"));
|
||||
while(!socket->isReady()) {
|
||||
if(socket->isFatal()) {
|
||||
m_listen->deleteSocket(socket);
|
||||
return;
|
||||
}
|
||||
LOG((CLOG_DEBUG2 "retrying sercure Connection"));
|
||||
ARCH->sleep(.5f);
|
||||
}
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG2 "sercure Connection established:%d"));
|
||||
|
||||
synergy::IStream* stream = socket;
|
||||
// filter socket messages, including a packetizing filter
|
||||
bool adopt = !m_useSecureNetwork;
|
||||
stream = new PacketStreamFilter(m_events, stream, adopt);
|
||||
|
||||
assert(m_server != NULL);
|
||||
|
||||
if (m_useSecureNetwork) {
|
||||
while(!socket->isReady()) {
|
||||
ARCH->sleep(.5f);
|
||||
}
|
||||
}
|
||||
|
||||
// create proxy for unknown client
|
||||
ClientProxyUnknown* client = new ClientProxyUnknown(stream, 30.0, m_server, m_events);
|
||||
m_newClients.insert(client);
|
||||
|
||||
Reference in New Issue
Block a user