|
|
@ -1,5 +1,5 @@ |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2013-2021, The PurpleI2P Project |
|
|
|
* Copyright (c) 2013-2022, 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 |
|
|
|
* |
|
|
|
* |
|
|
@ -1477,15 +1477,22 @@ namespace client |
|
|
|
*destination = 0; destination++; |
|
|
|
*destination = 0; destination++; |
|
|
|
auto session = FindSession (sessionID); |
|
|
|
auto session = FindSession (sessionID); |
|
|
|
if (session) |
|
|
|
if (session) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
auto localDest = session->GetLocalDestination (); |
|
|
|
|
|
|
|
auto datagramDest = localDest ? localDest->GetDatagramDestination () : nullptr; |
|
|
|
|
|
|
|
if (datagramDest) |
|
|
|
{ |
|
|
|
{ |
|
|
|
i2p::data::IdentityEx dest; |
|
|
|
i2p::data::IdentityEx dest; |
|
|
|
dest.FromBase64 (destination); |
|
|
|
dest.FromBase64 (destination); |
|
|
|
if (session->Type == eSAMSessionTypeDatagram) |
|
|
|
if (session->Type == eSAMSessionTypeDatagram) |
|
|
|
session->GetLocalDestination ()->GetDatagramDestination ()-> |
|
|
|
datagramDest->SendDatagramTo ((uint8_t *)eol, payloadLen, dest.GetIdentHash ()); |
|
|
|
SendDatagramTo ((uint8_t *)eol, payloadLen, dest.GetIdentHash ()); |
|
|
|
else if (session->Type == eSAMSessionTypeRaw) |
|
|
|
else // raw
|
|
|
|
datagramDest->SendRawDatagramTo ((uint8_t *)eol, payloadLen, dest.GetIdentHash ()); |
|
|
|
session->GetLocalDestination ()->GetDatagramDestination ()-> |
|
|
|
else |
|
|
|
SendRawDatagramTo ((uint8_t *)eol, payloadLen, dest.GetIdentHash ()); |
|
|
|
LogPrint (eLogError, "SAM: Unexpected session type ", (int)session->Type, "for session ", sessionID); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
LogPrint (eLogError, "SAM: Datagram destination is not set for session ", sessionID); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
LogPrint (eLogError, "SAM: Session ", sessionID, " not found"); |
|
|
|
LogPrint (eLogError, "SAM: Session ", sessionID, " not found"); |
|
|
|