Open quininer opened 3 years ago
Thanks for a heads-up, @quininer. I'm not expert on that part of the code, but it indeed looks like we can now simplify thanks to upstream bugfixes. CC @application-developer-DA @jxs @agalakhov.
hi @quininer, tokio-tungstenite
needs a compat layer similar to the one used on tokio-native-tls
as tungstenite
uses Read
and Write
traits directly. It started to use the same trick of tokio-native-tls
but was since upgraded to use the WakerProxy
trick on https://github.com/snapview/tokio-tungstenite/commit/6e566eced79d115d151df9d2efdc75482bb90b54
I see two possibilities:
1 - revert to use the same technique as tokio-native-tls
, is this what you are suggesting too right @quininer ? (has the unsafe
disadvantage but is simple to implement)
2 - decouple base tungstenite
from IO (similar to how quiche
was conceived, also see the SansIO manifesto) and have IO implementations depend on it (considerable time needed to try to implement, not 100% sure if feasible)
I would suggest going for 1 now, and consider 2 in the mid term cc @sdroege
This sounds great, and I am looking forward to 2. It would be great if there is a websocket library that works under no_std
.
I found it from deno's discussion.
tokio-tungstenite
uses the trick of WakerProxy to solve the wake-up problem of two-way IO. but this is not necessary in tokio, the related problem is reported as https://github.com/tokio-rs/tls/issues/40 .In short, the latest versions of
tokio::net::TcpStream
andtokio-rustls
are not affected by this issue.Given that this trick may cause lot spurious wakeups, we may be possible to provide an opt-out feature gate?