-
Notifications
You must be signed in to change notification settings - Fork 93
Adding support for io/wait and wait_readable/writable API, which matc… #170
base: master
Are you sure you want to change the base?
Conversation
…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)
io = io.to_io | ||
if IO.evented? | ||
mailbox = Thread.current[:celluloid_mailbox] | ||
mailbox.reactor.wait_readable(io) | ||
mailbox.reactor.wait_readable(io, timeout=nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, this sets the timeout to nil
always...
This could probably use some specs... |
@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 celluloid/celluloid#491 , code could be cleaned up after that. |
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 ( |
…d in the stack, big ups
@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 Since this is a different topic, we can discuss it there. I'll continue the |
… parameter within an io actor context
…ve been a higuer timeout or a timeout on the wait event; the latter is identified by the timeout parameter being passed or not, and therefore can nullify the timeout error caught; otherwise, timeout bubbles up
…lso trying to adhere to the convention; a successful wait_* call returns the socket; it returns nil otherwise
@TiagoCardoso1983 sounds good, I definitely would like to have |
…simple delegation will suffice
… it's the same code path, so I guess this one is safe
@tarcieri missing API was added, whenever you have some time for a review. |
…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)