MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / ConnectAfterIntroduction

Method ConnectAfterIntroduction

libi2pd/SSU2Session.cpp:215–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 }
214
215 void SSU2Session::ConnectAfterIntroduction ()
216 {
217 if (m_State == eSSU2SessionStateIntroduced)
218 {
219 // we are Alice
220 // keep ConnIDs used for introduction, because Charlie waits for SessionRequest from us
221 m_State = eSSU2SessionStateTokenReceived;
222 // move session to pending outgoing
223 if (m_Server.AddPendingOutgoingSession (shared_from_this ()))
224 {
225 m_Server.RemoveSession (GetConnID ());
226 // update endpoint in profile because we know it now
227 auto identity = GetRemoteIdentity ();
228 if (identity)
229 {
230 auto profile = i2p::data::GetRouterProfile (identity->GetIdentHash ());
231 if (profile) profile->SetLastEndpoint (m_RemoteEndpoint);
232 }
233 // connect
234 LogPrint (eLogDebug, "SSU2: Connecting after introduction to ", GetIdentHashBase64());
235 Connect ();
236 }
237 else
238 {
239 LogPrint (eLogError, "SSU2: Session ", GetConnID (), " is already pending");
240 m_Server.RequestRemoveSession (GetConnID ());
241 }
242 }
243 }
244
245 void SSU2Session::SendPeerTest ()
246 {

Callers 1

HandleRelayResponseMethod · 0.80

Calls 6

GetRouterProfileFunction · 0.85
LogPrintFunction · 0.85
SetLastEndpointMethod · 0.80
RequestRemoveSessionMethod · 0.80
RemoveSessionMethod · 0.45

Tested by

no test coverage detected