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

Method HandleI2PReceive

libi2pd_client/SAM.cpp:1130–1165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1128 }
1129
1130 void SAMSocket::HandleI2PReceive (const boost::system::error_code& ecode, std::size_t bytes_transferred)
1131 {
1132 if (ecode)
1133 {
1134 LogPrint (eLogError, "SAM: Stream read error: ", ecode.message ());
1135 if (ecode != boost::asio::error::operation_aborted)
1136 {
1137 if (bytes_transferred > 0)
1138 {
1139 WriteI2PData(bytes_transferred);
1140 }
1141 else
1142 {
1143 auto s = shared_from_this ();
1144 boost::asio::post (m_Owner.GetService (), [s] { s->Terminate ("stream read error"); });
1145 }
1146 }
1147 else
1148 {
1149 auto s = shared_from_this ();
1150 boost::asio::post (m_Owner.GetService (), [s] { s->Terminate ("stream read error (op aborted)"); });
1151 }
1152 }
1153 else
1154 {
1155 if (m_SocketType != SAMSocketType::eSAMSocketTypeTerminated)
1156 {
1157 if (bytes_transferred > 0)
1158 {
1159 WriteI2PData(bytes_transferred);
1160 }
1161 else
1162 I2PReceive();
1163 }
1164 }
1165 }
1166
1167 void SAMSocket::HandleWriteI2PData (const boost::system::error_code& ecode, size_t bytes_transferred)
1168 {

Callers 1

HandleI2PForwardMethod · 0.80

Calls 2

LogPrintFunction · 0.85
TerminateMethod · 0.45

Tested by

no test coverage detected