madsim-rs / madsim

Magical Deterministic Simulator for distributed systems in Rust.
Apache License 2.0
680 stars 48 forks source link

Don't expose `NetLocalHandle` or make it !Send #8

Closed wangrunji0408 closed 2 years ago

wangrunji0408 commented 2 years ago

NetLocalHandle is the entry point of all network operations. However, it should not be sent to other threads. One thread using a handle from other thread would cause it to block forever. The current API design is likely to be misused. For example, users tend to store the handle in a global state. To prevent that, we should either hide this type and make its methods static, or make this type !Send.

wangrunji0408 commented 2 years ago

Removed in f014a65