i2p: destroy the session if we get an unexpected error from the I2P router

From https://geti2p.net/en/docs/api/samv3:

  If SILENT=false was passed, which is the default value, the SAM bridge
  sends the client a ASCII line containing the base64 public destination
  key of the requesting peer

So, `Accept()` is supposed to receive a Base64 encoded destination of
the connecting peer, but if it receives something like this instead:

  STREAM STATUS RESULT=I2P_ERROR MESSAGE="Session was closed"

then destroy the session.
This commit is contained in:
Vasil Dimov
2023-07-14 15:17:43 +02:00
parent 762404a68c
commit 5c8e15c451
3 changed files with 139 additions and 26 deletions

View File

@@ -105,7 +105,7 @@ public:
* completion the `peer` member will be set to the address of the incoming peer.
* @return true on success
*/
bool Accept(Connection& conn);
bool Accept(Connection& conn) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);
/**
* Connect to an I2P peer.