Skip to content

Commit

Permalink
Update node_remote.rs (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtzxporter authored Jun 4, 2024
1 parent 19b412c commit 998a5ac
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hydra/src/node_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ async fn node_remote_supervisor(
}

pub async fn node_remote_accepter(socket: TcpStream, supervisor: Arc<NodeLocalSupervisor>) {
if let Err(error) = socket.set_nodelay(true) {
#[cfg(feature = "tracing")]
tracing::warn!(error = ?error, "Failed to set TCP_NODELAY on socket");

#[cfg(not(feature = "tracing"))]
let _ = error;
}

let framed = Framed::new(socket, Codec::new());
let (mut writer, mut reader) = framed.split();

Expand Down Expand Up @@ -383,6 +391,14 @@ pub async fn node_remote_connector(node: Node) {
.expect("Timed out while connecting to the node!")
.expect("Failed to connect to the node!");

if let Err(error) = socket.set_nodelay(true) {
#[cfg(feature = "tracing")]
tracing::warn!(error = ?error, "Failed to set TCP_NODELAY on socket");

#[cfg(not(feature = "tracing"))]
let _ = error;
}

let framed = Framed::new(socket, Codec::new());
let (mut writer, mut reader) = framed.split();

Expand Down

0 comments on commit 998a5ac

Please sign in to comment.