jonnydee / nzmqt

nzmqt - A lightweight C++ Qt binding for ZeroMQ
Other
199 stars 72 forks source link

ZMQSocket.socketActivity() keeps getting write notifications #1

Closed JelleHissink closed 12 years ago

JelleHissink commented 12 years ago

Hi Jonnydee,

When I create a SUB socket on tcp (either localhost or ip) I get continuous notifications on the socketActivity() slot, this prevents QTimer from running correctly. The source of the continuous calls is in the socketNotifyWrite_ notifier. Inside this call to socketActivity flags() always returns 0 and socketActivity() will be called again immediately flooding the event loop. I made a small modification to the source to prevent this by disabeling the notifier when flags() returns 0 and enabeling it again if sending fails because sending would block.

Regards, Jelle

jonnydee commented 12 years ago

Hello Jelle,

thank you very much for your bugfix. I've integrated it into my repo.

Best regards, Jonny

Am 08.12.2011 um 00:12 schrieb JelleHissink:

Hi Jonnydee,

When I create a SUB socket on tcp (either localhost or ip) I get continuous notifications on the socketActivity() slot, this prevents timers from running correctly. The source of the continuous calls is in the socketNotifyWrite_ notifier. flags() returns 0 and will be called again. I made a small modification to the source to prevent this by disabeling the notifier when flags() returns 0 and enabeling it again if sending fails because sending would block.

Regards, Jelle

You can merge this Pull Request by running:

git pull https://github.com/JelleHissink/nzmqt master

Or you can view, comment on it, or merge it online at:

https://github.com/jonnydee/nzmqt/pull/1

-- Commit Summary --

  • Disabled QSocketNotifier for writing when nothing is written

-- File Changes --

M include/nzmqt/nzmqt.hpp (835)

-- Patch Links --

https://github.com/jonnydee/nzmqt/pull/1.patch https://github.com/jonnydee/nzmqt/pull/1.diff


Reply to this email directly or view it on GitHub: https://github.com/jonnydee/nzmqt/pull/1

JelleHissink commented 12 years ago

Thanks for merging the change back!

Best regards, Jelle