2233 {
2235 request_message last_req;
2237 {
2238 std::lock_guard<std::mutex> g_c_conn( c->conn_mtx );
2239 if( !c->last_req ) {
2240 return;
2241 }
2242 peer_wlog( c,
"failed to fetch from peer" );
2243 if( c->last_req->req_blocks.mode ==
normal && !c->last_req->req_blocks.ids.empty() ) {
2244 bid = c->last_req->req_blocks.ids.back();
2245 } else {
2246 peer_wlog( c,
"no retry, block mpde = ${b} trx mode = ${t}",
2247 (
"b",
modes_str( c->last_req->req_blocks.mode ))(
"t",
modes_str( c->last_req->req_trx.mode ) ) );
2248 return;
2249 }
2250 last_req = *c->last_req;
2251 }
2253 if( conn == c )
2254 return true;
2255
2256 {
2257 std::lock_guard<std::mutex> guard( conn->conn_mtx );
2258 if( conn->last_req ) {
2259 return true;
2260 }
2261 }
2262
2264 if( sendit ) {
2265 conn->strand.post( [conn, last_req{std::move(last_req)}]() {
2266 conn->enqueue( last_req );
2267 conn->fetch_wait();
2268 std::lock_guard<std::mutex> g_conn_conn( conn->conn_mtx );
2269 conn->last_req = last_req;
2270 } );
2271 return false;
2272 }
2273 return true;
2274 } );
2275
2276
2278 if( c->connected() ) {
2279 c->enqueue( last_req );
2280 c->fetch_wait();
2281 }
2282 }
bool peer_has_block(const block_id_type &blkid, uint32_t connection_id) const
constexpr auto modes_str(id_list_modes m)
#define peer_wlog(PEER, FORMAT,...)