Skip to content

Commit

Permalink
more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Jun 24, 2024
1 parent dbca3cd commit ad2d2d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/netsim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
cd ../chuck/netsim
sudo kill -9 $(pgrep ovs) || true
sudo mn --clean || true
export RUST_LOG=debug,iroh_net=warn
export RUST_LOG=debug,iroh_net=warn,iroh::node=trace
c='${{ steps.detect_comment_config.outputs.NETSIM_CONFIG }}'
if [ -z "${c}" ];
then
Expand Down
11 changes: 10 additions & 1 deletion iroh/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,17 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
});

loop {
trace!("wait for tick");
tokio::select! {
biased;
_ = self.cancel_token.cancelled() => {
trace!("tick: cancel");
break;
},
// handle rpc requests. This will do nothing if rpc is not configured, since
// accept is just a pending future.
request = external_rpc.accept() => {
trace!("tick: external_rpc");
match request {
Ok((msg, chan)) => {
rpc::Handler::spawn_rpc_request(self.clone(), &mut join_set, msg, chan);
Expand All @@ -284,6 +287,7 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
},
// handle internal rpc requests.
request = internal_rpc.accept() => {
trace!("tick: internal_rpc");
match request {
Ok((msg, chan)) => {
rpc::Handler::spawn_rpc_request(self.clone(), &mut join_set, msg, chan);
Expand All @@ -295,6 +299,7 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
},
// handle incoming p2p connections.
Some(connecting) = self.endpoint.accept() => {
trace!("tick: endpoint.accept");
let protocols = protocols.clone();
join_set.spawn(async move {
handle_connection(connecting, protocols).await;
Expand All @@ -303,12 +308,16 @@ impl<D: iroh_blobs::store::Store> NodeInner<D> {
},
// handle task terminations and quit on panics.
res = join_set.join_next(), if !join_set.is_empty() => {
trace!("tick: join_set.join_next");
if let Some(Err(err)) = res {
error!("Task failed: {err:?}");
break;
}
},
else => break,
else => {
trace!("tick: else, break");
break;
}
}
}

Expand Down

0 comments on commit ad2d2d8

Please sign in to comment.