@@ -16,7 +16,7 @@ impl HistoryEvents {
16
16
loop {
17
17
tokio:: select! {
18
18
Some ( talk_request) = self . event_rx. recv( ) => {
19
- self . handle_history_talk_request( talk_request) . await ;
19
+ self . handle_history_talk_request( talk_request) ;
20
20
}
21
21
Some ( event) = self . utp_listener_rx. recv( ) => {
22
22
if let Err ( err) = self . network. overlay. process_utp_event( event) {
@@ -28,25 +28,27 @@ impl HistoryEvents {
28
28
}
29
29
30
30
/// Handle history network TalkRequest event
31
- async fn handle_history_talk_request ( & self , talk_request : TalkRequest ) {
32
- let reply = match self
33
- . network
34
- . overlay
35
- . process_one_request ( & talk_request)
36
- . instrument ( tracing:: info_span!( "history_network" ) )
37
- . await
38
- {
39
- Ok ( response) => {
40
- debug ! ( "Sending reply: {:?}" , response) ;
41
- Message :: from ( response) . into ( )
42
- }
43
- Err ( error) => {
44
- error ! ( "Failed to process portal history event: {error}" ) ;
45
- error. to_string ( ) . into_bytes ( )
31
+ fn handle_history_talk_request ( & self , talk_request : TalkRequest ) {
32
+ let network = Arc :: clone ( & self . network ) ;
33
+ tokio:: spawn ( async move {
34
+ let reply = match network
35
+ . overlay
36
+ . process_one_request ( & talk_request)
37
+ . instrument ( tracing:: info_span!( "history_network" ) )
38
+ . await
39
+ {
40
+ Ok ( response) => {
41
+ debug ! ( "Sending reply: {:?}" , response) ;
42
+ Message :: from ( response) . into ( )
43
+ }
44
+ Err ( error) => {
45
+ error ! ( "Failed to process portal history event: {error}" ) ;
46
+ error. to_string ( ) . into_bytes ( )
47
+ }
48
+ } ;
49
+ if let Err ( error) = talk_request. respond ( reply) {
50
+ warn ! ( "Failed to send reply: {error}" ) ;
46
51
}
47
- } ;
48
- if let Err ( error) = talk_request. respond ( reply) {
49
- warn ! ( "Failed to send reply: {error}" ) ;
50
- }
52
+ } ) ;
51
53
}
52
54
}
0 commit comments