Closed hannesg closed 8 years ago
This looks really good. I'll help where I can with merging and testing. This PR introduces a few new things into the Celluloid namespace. Is there any chance this will break existing code?
Can we also review the errors on Travis?
Hmm, interesting. In general I think it looks good but I might try to leave you some line notes at some point.
@hannesg Can you please address my feedback and then let's get this merged. It's a good idea, the implementation looks fine, I'd like to test it.
The way the try_convert
method handles individual socket types in a static switch/case statement is going to bottleneck/undermine the intention of this change.
I'd reference the interface to Celluloid::SystemEvent
which allows dynamic handling of different types of object, via the handler
block definition at a superclass level, then invocation of that on a subclass level... in this case that'd be converter
or the like:
https://github.com/celluloid/celluloid/blob/master/lib/celluloid/system_events.rb#L20
@digitalextremist That handler method looks, on the surface, incredibly inefficient, doing all that string manipulation.
I'm going to merge this and then fix up any remaining issues.
Okay this is now merged and normalised. Thanks so much for your contributions.
This is my approach on the proposed solution for #129
The new superclass is called Celluloid::IO::Socket and essentialy deduplicates all #to_io methods and many delegates. This allows all socket wrappers to be created from a raw ruby socket using their default initializer or the new C::IO::Socket.try_convert method.
I've added some methods for backward compatibility so that code like this doesn't break:
Cheers' Hannes