mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 17:21:34 +00:00
[libp2p-ping] Properly close the substream in the InboundUpgrade. (#1606)
Not doing so may result in FIN/RST frames being sent before earlier data frames. See https://github.com/paritytech/yamux/pull/81#issuecomment-643169973.
This commit is contained in:
@ -69,6 +69,7 @@ where
|
|||||||
while let Ok(_) = socket.read_exact(&mut payload).await {
|
while let Ok(_) = socket.read_exact(&mut payload).await {
|
||||||
socket.write_all(&payload).await?;
|
socket.write_all(&payload).await?;
|
||||||
}
|
}
|
||||||
|
socket.close().await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}.boxed()
|
}.boxed()
|
||||||
}
|
}
|
||||||
@ -128,7 +129,7 @@ mod tests {
|
|||||||
} else {
|
} else {
|
||||||
panic!("MemoryTransport not listening on an address!");
|
panic!("MemoryTransport not listening on an address!");
|
||||||
};
|
};
|
||||||
|
|
||||||
async_std::task::spawn(async move {
|
async_std::task::spawn(async move {
|
||||||
let listener_event = listener.next().await.unwrap();
|
let listener_event = listener.next().await.unwrap();
|
||||||
let (listener_upgrade, _) = listener_event.unwrap().into_upgrade().unwrap();
|
let (listener_upgrade, _) = listener_event.unwrap().into_upgrade().unwrap();
|
||||||
|
Reference in New Issue
Block a user