celluloid / celluloid-zmq

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid actors that talk over the 0MQ protocol
https://celluloid.io
MIT License
83 stars 25 forks source link

Rewrite of wait_readable to use the Cellulid::ZMQ mailbox reactor #21

Closed CootCraig closed 11 years ago

CootCraig commented 11 years ago

A change in response to #20

halorgium commented 11 years ago

@CootCraig could you remove the version changes in this commit? Did you get what I meant about moving #evented? to the module and using that in the wait_* methods?

CootCraig commented 11 years ago

@halorgium I'm removing the version change and yes I'll move #evented?

CootCraig commented 11 years ago

Pushed changes to the craig branch on CootCraig/celluloid-zmq

Move the evented? function to the module, Celluloid::ZMQ.evented? On the socket read, only call Celluloid::ZMQ.wait_readable if Celluloid::ZMQ.evented? Set the version back to 0.13.0 Set the celluloid-io dependency back to 0.13.0

halorgium commented 11 years ago

@CootCraig I am not sure the change is being solved in the right way here. Could you jump on IRC? We can talk through the change.

Also, I just cleaned up celluloid-io.

CootCraig commented 11 years ago

I just got up for the day. Let me know about doing IRC. I'll fetch the latest and have a look now.

CootCraig commented 11 years ago

Also my read test case is working on Windows JRuby as well.

$ jruby -v jruby 1.7.4.dev (1.9.3p392) 2013-04-16 cb556ed on Java HotSpot(TM) Client VM 1.8 .0-ea-b78 +indy [Windows 2003-x86]

CootCraig commented 11 years ago

I have grabbed the spelling change by @halorgium and done a new branch with ZMQ::Socket#read changes. branch fix-0mq-io-wait on CootCraig/celluloid-zmq Notes: zmq.rb: removed the reactor delegators. zmq.rb: add ZMQ::evented? - Is this a Celluloid::ZMQ evented actor? zmq.rb: add ZMQ::wait_readable using the ZMQ::Reactor zmq/sockets.rb: evented? now in zmq.rb. remove Socket#evented? zmq/sockets.rb: Change Socket#read to use ZMQ#wait_readable

I have kept the evented? guard on the wait in Socket#read. This would prevent an exception if evented? fails and the 0mq socket read that follows is not evented.

CootCraig commented 11 years ago

I have a test script that does Socket#read with Celluloid/zmq. It is working on Ubuntu and Windows with these JRuby environments

$ jruby -v jruby 1.7.4.dev (1.9.3p392) 2013-04-16 cb556ed on Java HotSpot(TM) 64-Bit Server VM 1.8.0-ea-b80 +indy [linux-amd64]

$ jruby -v jruby 1.7.4.dev (1.9.3p392) 2013-04-16 cb556ed on Java HotSpot(TM) Client VM 1.8.0-ea-b78 +indy [Windows 2003-x86]

CootCraig commented 11 years ago

Also I made no changes for Socket#write.

halorgium commented 11 years ago

@CootCraig sorry I missed you on IRC, timezones are hard! We have another few changes we are looking at making on top of this, I will try and get this finished and merged. I hope you get a chance to have a look at the solution, I appreciate the time taken!

halorgium commented 11 years ago

See #20