softprops / hyperlocal

🔌 ✨rustlang hyper bindings for local unix domain sockets
MIT License
229 stars 46 forks source link

Fix use of blocking wait() that can stall the runtime. #18

Closed arsing closed 5 years ago

arsing commented 5 years ago

Before this change, the client could sometimes hang at the wait(), because the wait() had blocked the same runtime that was trying to make progress on the connect future. The original code had this cryptic comment:

https://github.com/softprops/hyperlocal/blob/d9c4dfba855bc0f582b48a0512615396dffe7dd4/src/client/mod.rs#L55

I assume it was done that way because it could not have used a Future::map() combinator on the UnixStream::connect() future while also keeping the FutureResult return type.

This change makes it use a custom Future impl instead of blocking the runtime.

cc @dylanmckay

softprops commented 5 years ago

@arsing these changes where published in 0.6.0

dylanmckay commented 5 years ago

This is good @arsing , thanks for catching and fixing this!