File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -366,10 +366,17 @@ impl AuxiliaryState {
366366 // Channels for communication with the auxiliary loop
367367 let ( auxiliary_event_tx, auxiliary_event_rx) = tokio_unbounded_channel :: < AuxiliaryEvent > ( ) ;
368368
369- // Set global instance of this channel. This is used for logging
370- // messages from a free function.
369+ // Set global instance of this channel. This is used for interacting
370+ // with the auxiliary loop (logging messages or spawning a task) from
371+ // free functions.
371372 unsafe {
372- AUXILIARY_EVENT_TX . set ( auxiliary_event_tx. clone ( ) ) . unwrap ( ) ;
373+ if let Some ( val) = AUXILIARY_EVENT_TX . get_mut ( ) {
374+ // Reset channel if already set. Happens e.g. on reconnection after a refresh.
375+ * val = auxiliary_event_tx. clone ( ) ;
376+ } else {
377+ // Set channel for the first time
378+ AUXILIARY_EVENT_TX . set ( auxiliary_event_tx. clone ( ) ) . unwrap ( ) ;
379+ }
373380 }
374381
375382 // List of pending tasks for which we manage the lifecycle (mainly relay
You can’t perform that action at this time.
0 commit comments