Closed gnoack closed 8 years ago
I think this is #42 again. The reason is the simplistic way mioco translates connection to mio connection, yes.
Let me hack on this for a moment...
Please reopen if something is wrong with it! I'm always happy to fix bug reports.
Awesome, works great! Thanks for the quick bugfix! :)
Thanks for your work on Mioco! This has been a breeze to use so far, apart from this little bug. :)
Steps to reproduce:
mioco::tcp::TcpStream::connect(&addr)
and point it to a non-listening localhost port.Ok(socket)
result with a socket object instead of an error.Expected behaviour:
Rationale:
I would have assumed that
TcpStream::connect()
should provide a synchronous programming model when invoked from a mioco coroutine. That would be consistent with what synchronous TCP APIs do.Suspicion:
In the mio library,
TcpStream::connect()
is first setting the socket into non-blocking mode and then treating theEINPROGRESS
error as successful. (src/sys/unix/tcp.rs:38)Maybe I'm misunderstanding something about the API? Is there another way in which I can detect this scenario in mioco without doing reads and writes on the socket already?