zeromq / chumak

Pure Erlang implementation of ZeroMQ Message Transport Protocol.
Mozilla Public License 2.0
197 stars 47 forks source link

Add `unblock` behavior to SUB sockets. #31

Closed illegalprime closed 5 years ago

illegalprime commented 5 years ago

There is no way to recv a message and then timeout if no messages are received in a certain time span. Since killing the process that is calling recv will cause the handle to it to get cleaned up by the library. This PR introduces the unblock behavior which causes the server to clear the pending_recv PID and send it a {error, again} similar to what ZMQ already does here:

http://api.zeromq.org/4-1:zmq-setsockopt#toc29

If you think this design is good I can replicate it to all other sockets implementing chumak_pattern.

drozzy commented 5 years ago

Thanks, please do!