[zeromq-dev] potential fix for issue #50

Chuck Remes cremes.devlist at mac.com
Sat Feb 12 00:38:22 CET 2011

I started mucking around with the code in mailbox::send() to fix the assertion that OSX users (like me) oftentimes get in high-volume situations.

For one, getsockopt() returns 0 on OSX! So the line to expand the SNDBUF doesn't work:

  new_sndbuf = old_sndbuf * 2;

Obviously, 0 times anything is 0 so the expansion fails.

The other weird thing on OSX is that when getsockopt() does return a valid value, it's in kilobytes instead of bytes. That is, it will return 32 when it should return 32768.

So I rewrote the logic to expand the buffer like so:

  new_sndbuf = (old_sndbuf == 0) ? 32768 : (old_sndbuf * 2048);

It works. I no longer get the assertion.

However, that code will likely break horribly on linux. 



More information about the zeromq-dev mailing list