Yielding tokio task upon creating loop/real traffic message (#166)
This commit is contained in:
committed by
GitHub
parent
425746e215
commit
c401222a84
@@ -99,6 +99,9 @@ impl<T: 'static + NymTopology> LoopCoverTrafficStream<T> {
|
||||
self.mix_tx
|
||||
.unbounded_send(MixMessage::new(cover_message.0, cover_message.1))
|
||||
.unwrap();
|
||||
// JS: due to identical logical structure to OutQueueControl::on_message(), this is also
|
||||
// presumably required to prevent bugs in the future. Exact reason is still unknown to me.
|
||||
tokio::task::yield_now().await;
|
||||
}
|
||||
|
||||
async fn run(&mut self) {
|
||||
|
||||
@@ -345,6 +345,8 @@ impl NymClient {
|
||||
input_tx.clone(),
|
||||
);
|
||||
self.input_tx = Some(input_tx);
|
||||
self.receive_tx = Some(received_messages_buffer_output_tx)
|
||||
self.receive_tx = Some(received_messages_buffer_output_tx);
|
||||
|
||||
info!("Client startup finished!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,9 @@ impl<T: 'static + NymTopology> OutQueueControl<T> {
|
||||
self.mix_tx
|
||||
.unbounded_send(MixMessage::new(next_packet.0, next_packet.1))
|
||||
.unwrap();
|
||||
// JS: Not entirely sure why or how it fixes stuff, but without the yield call,
|
||||
// the UnboundedReceiver [of mix_rx] will not get a chance to read anything
|
||||
tokio::task::yield_now().await;
|
||||
}
|
||||
|
||||
pub(crate) async fn run_out_queue_control(mut self) {
|
||||
|
||||
Reference in New Issue
Block a user