| 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 | { |
nothing calls this directly
no test coverage detected