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

Method ProcessSessionRemove

libi2pd_client/SAM.cpp:919–943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

917 }
918
919 void SAMSocket::ProcessSessionRemove (std::string_view buf)
920 {
921 if (m_Version < SAM_VERSION_33) // < SAM 3.3
922 {
923 SendSessionI2PError("SESSION REMOVE is not supported");
924 return;
925 }
926 auto session = m_Owner.FindSession(m_ID);
927 if (session && session->Type == SAMSessionType::eSAMSessionTypeMaster)
928 {
929 LogPrint (eLogDebug, "SAM: Subsession remove: ", buf);
930 auto masterSession = std::static_pointer_cast<SAMMasterSession>(session);
931 auto params = ExtractParams (buf);
932 std::string id(params[SAM_PARAM_ID]);
933 if (!masterSession->subsessions.erase (id))
934 {
935 SendMessageReply (SAM_SESSION_STATUS_INVALID_KEY, false);
936 return;
937 }
938 m_Owner.CloseSession (id);
939 SendSessionCreateReplyOk ();
940 }
941 else
942 SendSessionI2PError ("Wrong session type");
943 }
944
945 void SAMSocket::ProcessPing (std::string_view text)
946 {

Callers

nothing calls this directly

Calls 3

LogPrintFunction · 0.85
CloseSessionMethod · 0.80
FindSessionMethod · 0.45

Tested by

no test coverage detected