celluloid / celluloid-io

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

Provide an actor-level select which can accept multiple sockets #178

Open HoneyryderChuck opened 8 years ago

HoneyryderChuck commented 8 years ago

Looking at here, there is a feature missing to wait on more than one socket, something like IO.select([ios]), but tailored to celluloid-io.

I was picturing maybe exposing the #select method from the reactor selector instance (there should be only one per actor, therefore something like Actor.current.select(), which doesn't necessarily have to follow the same ruby IO.select API.

use case

net-ssh v4 will come with an internal event loop: https://github.com/net-ssh/net-ssh/blob/master/lib/net/ssh/connection/event_loop.rb .

This is supposed to handle the case in which one has to listen to events on the session socket and eventually the forwarding socket, the gateway socket, etc. It would be cool if one could expose the event loop and monitor more than one socket (or maybe what one needs is multi-socket Monitors? nio4r?).

I'm a bit lost in how this API could look and whether the internals allow this, I just wanted to see if there's some limitation I'm missing.