jeapostrophe/zeromq — pull request #2 by ppolv (2012-04-06 23:58:10+00:00)
Title: Received messages are released too soon

Hi,
while using the 0mq bindings to have some fun while learning racket, I think I found a small problem.
(socket-recv! sock) is releasing the received message too soon.
Its byte contents might be used by the caller after they were already released or reused by 0mq, this is particular true on high-rate scenarios with messages larger than just a few bytes.

The patch do the simplest fix: just copy the bytes.
A better API that lets the caller access the data without copying it, and then release the underling msg when done will be useful to avoid double-copying in many situations, being the caller's responsibility to copy the data somewhere if he need to access it latter. But that's beyond my current racket abilities ;)