@@ -337,6 +337,7 @@ impl DhtDriver {
337337 tokio:: spawn ( async move {
338338 if let Some ( ( _conn, mut send) ) = maybe_send {
339339 let _ = write_response_to_stream (
340+ inbound_id,
340341 & mut send,
341342 & DhtResponse :: Error {
342343 code : ErrorCode :: InvalidRequest ,
@@ -465,7 +466,7 @@ impl DhtDriver {
465466 self_id,
466467 _conn. to_info( )
467468 ) ;
468- let _ = write_response_to_stream ( & mut send, & response) . await ;
469+ let _ = write_response_to_stream ( inbound_id , & mut send, & response) . await ;
469470 }
470471 let _ = io_tx. send ( DhtIo :: InboundDropped { inbound_id } ) . await ;
471472 } ) ;
@@ -733,6 +734,11 @@ async fn rpc_request(
733734 . await ?
734735 . map_err ( DhtIoError :: network) ?;
735736
737+ let timeout = tokio:: time:: timeout ( Duration :: from_millis ( 100 ) , send. stopped ( ) ) . await ;
738+ if let Err ( timer) = timeout {
739+ warn ! ( op_id, "RPC_REQUEST: Send timer elapsed {}" , timer) ;
740+ }
741+
736742 trace ! ( op_id, "RPC_REQUEST: Decode response" ) ;
737743
738744 Ok ( decode_response ( & response_bytes) ?)
@@ -766,6 +772,7 @@ async fn read_request_from_stream(recv: &mut RecvStream) -> Result<DhtRequest, D
766772}
767773
768774async fn write_response_to_stream (
775+ inbound_id : InboundId ,
769776 send : & mut SendStream ,
770777 response : & DhtResponse ,
771778) -> Result < ( ) , DhtIoError > {
@@ -782,7 +789,10 @@ async fn write_response_to_stream(
782789 . map_err ( DhtIoError :: network) ?;
783790 send. finish ( ) . map_err ( DhtIoError :: network) ?;
784791
785- let _ = tokio:: time:: timeout ( Duration :: from_millis ( 100 ) , send. stopped ( ) ) . await ;
792+ let timeout = tokio:: time:: timeout ( Duration :: from_millis ( 500 ) , send. stopped ( ) ) . await ;
793+ if let Err ( timer) = timeout {
794+ warn ! ( inbound_id, "RPC_RESPONSE: Send timer elapsed {}" , timer) ;
795+ }
786796
787797 Ok ( ( ) )
788798}
0 commit comments