Browse Source

check if session socket was closed before tunnels were built

pull/1849/head
orignal 2 years ago
parent
commit
7146a4dbae
  1. 7
      libi2pd_client/SAM.cpp
  2. 4
      libi2pd_client/SAM.h

7
libi2pd_client/SAM.cpp

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2022, The PurpleI2P Project * Copyright (c) 2013-2023, The PurpleI2P Project
* *
* This file is part of Purple i2pd project and licensed under BSD3 * This file is part of Purple i2pd project and licensed under BSD3
* *
@ -439,6 +439,8 @@ namespace client
void SAMSocket::HandleSessionReadinessCheckTimer (const boost::system::error_code& ecode) void SAMSocket::HandleSessionReadinessCheckTimer (const boost::system::error_code& ecode)
{ {
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
{
if (m_Socket.is_open ())
{ {
auto session = m_Owner.FindSession(m_ID); auto session = m_Owner.FindSession(m_ID);
if(session) if(session)
@ -453,6 +455,9 @@ namespace client
} }
} }
} }
else
Terminate ("SAM: session socket closed");
}
} }
void SAMSocket::SendSessionCreateReplyOk () void SAMSocket::SendSessionCreateReplyOk ()

4
libi2pd_client/SAM.h

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2021, The PurpleI2P Project * Copyright (c) 2013-2023, The PurpleI2P Project
* *
* This file is part of Purple i2pd project and licensed under BSD3 * This file is part of Purple i2pd project and licensed under BSD3
* *
@ -30,7 +30,7 @@ namespace client
{ {
const size_t SAM_SOCKET_BUFFER_SIZE = 8192; const size_t SAM_SOCKET_BUFFER_SIZE = 8192;
const int SAM_SOCKET_CONNECTION_MAX_IDLE = 3600; // in seconds const int SAM_SOCKET_CONNECTION_MAX_IDLE = 3600; // in seconds
const int SAM_SESSION_READINESS_CHECK_INTERVAL = 20; // in seconds const int SAM_SESSION_READINESS_CHECK_INTERVAL = 3; // in seconds
const char SAM_HANDSHAKE[] = "HELLO VERSION"; const char SAM_HANDSHAKE[] = "HELLO VERSION";
const char SAM_HANDSHAKE_REPLY[] = "HELLO REPLY RESULT=OK VERSION=%s\n"; const char SAM_HANDSHAKE_REPLY[] = "HELLO REPLY RESULT=OK VERSION=%s\n";
const char SAM_HANDSHAKE_NOVERSION[] = "HELLO REPLY RESULT=NOVERSION\n"; const char SAM_HANDSHAKE_NOVERSION[] = "HELLO REPLY RESULT=NOVERSION\n";

Loading…
Cancel
Save