chuckremes / ffi-rzmq

FFI bindings for ZeroMQ so the library can be used under JRuby and other FFI-compliant ruby runtimes
242 stars 62 forks source link

fix for: Uncaught exception: undefined method resultcode_ok?' #128

Closed valeraradu closed 6 years ago

valeraradu commented 6 years ago

Uncaught exception: undefined method >=' for nil:NilClass ~/.rvm/gems/ruby-2.3.1/gems/ffi-rzmq-2.0.5/lib/ffi-rzmq/util.rb:33:inresultcode_ok?' ~/.rvm/gems/ruby-2.3.1/gems/zss-0.3.4/lib/zss/socket.rb:95:in check!' ~/.rvm/gems/ruby-2.3.1/gems/zss-0.3.4/lib/zss/socket.rb:55:incontext' ~/.rvm/gems/ruby-2.3.1/gems/zss-0.3.4/lib/zss/socket.rb:26:in call' ~/.rvm/gems/ruby-2.3.1/gems/zss-0.3.4/lib/zss/client.rb:36:incall' ~/.rvm/gems/ruby-2.3.1/gems/zss-0.3.4/lib/zss/client.rb:55:in method_missing' ~/ruby_microservice_test/zmq-service-suite-ruby-bootstrap/bin/zss-client:15:in<top (required)>'

chuckremes commented 6 years ago

@valeraradu I'll accept a PR to fix this with some changes. Note that the problem is caused by this call in the zss gem.

https://github.com/micro-toolkit/zmq-service-suite-ruby/blob/master/lib/zss/socket.rb#L55

It's a call to ctx.terminate which is somehow returning nil. That should never happen.

I'd prefer the fix to be made here:

https://github.com/chuckremes/ffi-rzmq/blob/master/lib/ffi-rzmq/context.rb#L87

Make that code: rc || 0

I'll accept that PR.

valeraradu commented 6 years ago

can confirm that your proposed change fixes that error, will open new PR