Class: ZMQ::Message
- Inherits:
-
Object
- Object
- ZMQ::Message
- Defined in:
- lib/logjam_agent/monkey_patches/ffi-rzmq-patch.rb
Instance Method Summary collapse
Instance Method Details
#copy_in_bytes(bytes, len) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/logjam_agent/monkey_patches/ffi-rzmq-patch.rb', line 8 def copy_in_bytes bytes, len data_buffer = LibC.malloc len # writes the exact number of bytes, no null byte to terminate string data_buffer.put_bytes 0, bytes, 0, len # use libC to call free on the data buffer; earlier versions used an # FFI::Function here that called back into Ruby, but Rubinius won't # support that and there are issues with the other runtimes too LibZMQ.zmq_msg_init_data @pointer, data_buffer, len, LibC::Free, nil end |