Skip to content

Commit

Permalink
fix: Improve debug messages in zenoh-transport (eclipse-zenoh#1090)
Browse files Browse the repository at this point in the history
* fix: Improve debug messages for failing RX/TX tasks

* fix: Improve debug message for `accept_link` timeout

* chore: Fix `clippy::redundant_pattern_matching` error
  • Loading branch information
fuzzypixelz authored Jun 5, 2024
1 parent ce43f58 commit c279982
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions io/zenoh-transport/src/multicast/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ impl TransportLinkMulticastUniversal {
)
.await;
if let Err(e) = res {
tracing::debug!("{}", e);
tracing::debug!("TX task failed: {}", e);
// Spawn a task to avoid a deadlock waiting for this same task
// to finish in the close() joining its handle
zenoh_runtime::ZRuntime::Net.spawn(async move { c_transport.delete().await });
Expand Down Expand Up @@ -378,7 +378,7 @@ impl TransportLinkMulticastUniversal {
.await;
c_signal.trigger();
if let Err(e) = res {
tracing::debug!("{}", e);
tracing::debug!("RX task failed: {}", e);
// Spawn a task to avoid a deadlock waiting for this same task
// to finish in the close() joining its handle
zenoh_runtime::ZRuntime::Net.spawn(async move { c_transport.delete().await });
Expand Down
8 changes: 6 additions & 2 deletions io/zenoh-transport/src/unicast/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,13 +746,17 @@ impl TransportManager {
let c_manager = self.clone();
self.task_controller
.spawn_with_rt(zenoh_runtime::ZRuntime::Acceptor, async move {
if let Err(e) = tokio::time::timeout(
if tokio::time::timeout(
c_manager.config.unicast.accept_timeout,
super::establishment::accept::accept_link(link, &c_manager),
)
.await
.is_err()
{
tracing::debug!("{}", e);
tracing::debug!(
"Failed to accept link before deadline ({}ms)",
c_manager.config.unicast.accept_timeout.as_millis()
);
}
incoming_counter.fetch_sub(1, SeqCst);
});
Expand Down
4 changes: 2 additions & 2 deletions io/zenoh-transport/src/unicast/universal/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl TransportLinkUnicastUniversal {
.await;

if let Err(e) = res {
tracing::debug!("{}", e);
tracing::debug!("TX task failed: {}", e);
// Spawn a task to avoid a deadlock waiting for this same task
// to finish in the close() joining its handle
// TODO(yuyuan): do more study to check which ZRuntime should be used or refine the
Expand Down Expand Up @@ -125,7 +125,7 @@ impl TransportLinkUnicastUniversal {

// TODO(yuyuan): improve this callback
if let Err(e) = res {
tracing::debug!("{}", e);
tracing::debug!("RX task failed: {}", e);

// Spawn a task to avoid a deadlock waiting for this same task
// to finish in the close() joining its handle
Expand Down

0 comments on commit c279982

Please sign in to comment.