| 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 | { |
no test coverage detected