Patching ZeroMQ – Pretty Neat

ZeroMQ

This morning I was chatting with Martin S. on the ZeroMQ IRC channel and there was a suggestion of how to handle the "socket recovery interval in msec" option in the code. He pointed out that I'd need to change the ZeroMQ code, and why didn't I do that and then send the patch to the mailing list and he'd incorporate it.

Sweet! A request for a (simple) patch to the codebase by the primary maintainer. I like this stuff. It's not hard, but there are a few wrinkles, and the coding standards are at least in existance, which is a huge help to the project. I just need to get a few things figured out, write the code, compile it all up, and then make the diff for the mailing list.

I'm sure there's going to be a lot of little details I learn as I do this, but it's nice to get a chance to contribute to another nice open source project.

UPDATE: I've pretty much got it all done, but the hint I received from the guy that really knows OpenPGM in the group is a little sketchy. He gave me an equation which includes the size of the transport package:

Easy workaround is to calculate the buffer size in sequence numbers in 0MQ and pass that onto OpenPGM. Then you can export socket options for 0MQ to set the buffer size in seconds, milliseconds, etc.

int sqns = (secs * max_rte) / tpdu_size;
pgm_setsockopt (sock, IPPROTO_PGM, PGM_TXW_SQNS, &sqns, sizeof (sqns));

I think I found what should go in that spot, but I wasn't 100% sure. So I replied to the guy on the mailing list and now I'm waiting for confirmation/correction from him. It shouldn't take too much longer to finish this up, and then I'll have a way to set the ZMQ_RECOVERY_IVL_MSEC - which, with a non-zero value, will override the ZMQ_RECOVERY_IVL value and use the value in milliseconds. Should be pretty easy to finish.