celluloid / celluloid-io

UNMAINTAINED: See celluloid/celluloid#779 - Evented sockets for Celluloid actors
https://celluloid.io
MIT License
879 stars 93 forks source link

Adding support for io/wait and wait_readable/writable API, which matc… #170

Open HoneyryderChuck opened 8 years ago

HoneyryderChuck commented 8 years ago

…hes the Celluloid IO Socket APIs, excepted for the signature; Added support for timeout parameter, which will bubble down to Celluloid.timeout; falling back to Kernel.select when the io does not define the method (SSLSockets) or when the implementation in the ruby VMs is buggy (TCPServer and UNIXServer#wait_readable/writable are throwing Errno::EINVAL, weird)

tarcieri commented 8 years ago

This could probably use some specs...

HoneyryderChuck commented 8 years ago

@tarcieri I didn't want to write any specs before clearing the awful bit of code inside the reactor. I really think it's time someone takes a look at https://github.com/celluloid/celluloid/pull/491 , code could be cleaned up after that.

tarcieri commented 8 years ago

I didn't want to write any specs before clearing the awful bit of code inside the reactor.

Why? You are trying to reimplement core Ruby behavior which is completely orthogonal to the reactor.

I mentioned specs specifically because your code has obvious bugs in it (timeout = nil as a parameter to a method invocation)

HoneyryderChuck commented 8 years ago

@tarcieri maybe I expressed myself in a wrong way. Specs will come. This pull request is far from over. The main goal of it (and this should have been stated in the main description) is to add celluloid-io-compatible reimplementations of the io/wait methods, of which wait_readable and wait_writable are only two. I want to get the specs sorted out, but I wanted to discuss this here, which looks rather ugly because Celluloid.timeout is still a private method. That pull request I linked (which is quite old) not only fixes that, but also provides a Timeout.timeout compatible signature, something that has been hindering proper support for some core network libraries.

Since this is a different topic, we can discuss it there. I'll continue the io/wait part on this side.

tarcieri commented 8 years ago

@TiagoCardoso1983 sounds good, I definitely would like to have io/wait compatibility

HoneyryderChuck commented 8 years ago

@tarcieri FYI https://github.com/ruby/net-telnet/pull/3

HoneyryderChuck commented 8 years ago

@tarcieri missing API was added, whenever you have some time for a review.