fix(fake-tcp) more robust checking for receiving end closing, avoids

panicking tasks from causing server to stop completely
This commit is contained in:
Datong Sun 2021-10-09 09:22:20 -07:00
parent 427fb7c19a
commit 41e86521b7

View File

@ -385,9 +385,15 @@ impl Stack {
let tuple = AddrTuple::new(local_addr, remote_addr);
if let Some(c) = tuples.get(&tuple) {
c.send(buf).await.unwrap();
if c.send(buf).await.is_err() {
trace!("Cache hit, but receiver already closed, dropping packet");
}
continue;
// If not Ok, receiver has been closed and just fall through to the slow
// path below
} else {
trace!("Cache miss, checking the shared tuples table for connection");
let sender;