Skip to content

Commit d66bed5

Browse files
committed
handle listen receiver close
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
1 parent c9cc7a9 commit d66bed5

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • crates/wasi/src/p3/sockets/host/types

crates/wasi/src/p3/sockets/host/types/tcp.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,16 @@ impl<T> AccessorTask<T, WasiSockets, wasmtime::Result<()>> for ListenTask {
178178
.push(TcpSocket::from_state(state, self.family))
179179
.context("failed to push socket to table")
180180
})?;
181-
self.tx.write(store, Some(socket)).await;
181+
if let Some(socket) = self.tx.write(store, Some(socket)).await {
182+
// Receiver exited
183+
store.with(|mut view| {
184+
view.get()
185+
.table
186+
.delete(socket)
187+
.context("failed to delete socket resource from table")
188+
})?;
189+
return Ok(());
190+
}
182191
}
183192
}
184193
}

0 commit comments

Comments
 (0)