Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! This is useful for std based devices/applications that can directly connect to a DirectRouter
//! using a udp connection.

use std::io::ErrorKind;
use std::sync::Arc;

use crate::{
Expand Down Expand Up @@ -181,7 +182,14 @@ async fn tx_worker(tx: Arc<UdpSocket>, rx: FramedConsumer<StdQueue>, closer: Arc
let res = tx.send(&frame).await;
frame.release();
if let Err(e) = res {
error!("Tx Error. socket: {:?}, error: {:?}", tx, e);
match e.kind() {
// On Linux, the /SECOND/ `send` will cause a `ConnectionRefused` error when there
// is nothing listening and the source/destination are on the same host.
ErrorKind::ConnectionRefused => {},
Comment on lines +186 to +188
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no guarantee it happens on the second send. See the Tokio issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, yes, so perhaps the wording should be:

On Linux, /LATER/ calls to send /MAY/ cause a ConnectionRefused error when there is nothing listening and the source/destination are on the same host.

Thoughts? Improvements?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. The rewording you proposed looks correct, just needs to be pushed.
Otherwise LGTM.

_ => {
error!("Tx Error. socket: {:?}, error: {:?}", tx, e);
}
}
}
}
// TODO: GC waker?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//!
//! This implementation can be used to connect to a number of direct edge UDP devices.

use std::io::ErrorKind;
use crate::logging::{debug, error, info, trace, warn};
use bbq2::{prod_cons::framed::FramedConsumer, traits::bbqhdl::BbqHandle};
use maitake_sync::WaitQueue;
Expand Down Expand Up @@ -70,8 +71,15 @@ impl TxWorker {
let res = self.tx.send(&frame).await;
frame.release();
if let Err(e) = res {
error!("Tx Error. socket: {:?}, error: {:?}", self.tx, e);
break;
match e.kind() {
// On Linux, the SECOND `send` will cause a `ConnectionRefused` error when there
// is nothing listening and the source/destination are on the same host.
ErrorKind::ConnectionRefused => {},
_ => {
error!("Tx Error. socket: {:?}, error: {:?}", self.tx, e);
break;
}
}
}
}
}
Expand Down