[Pkg-bitcoin-commits] [python-quamash] 156/269: Ignore socket notifiers that should be out of commission
Jonas Smedegaard
dr at jones.dk
Fri Nov 24 11:26:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository python-quamash.
commit 43256c066434f62da23a8480c6919ac956e4f12d
Author: Arve Knudsen <arve.knudsen at gmail.com>
Date: Mon Dec 8 19:03:02 2014 +0100
Ignore socket notifiers that should be out of commission
---
quamash/__init__.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/quamash/__init__.py b/quamash/__init__.py
index 001aa6f..422866d 100644
--- a/quamash/__init__.py
+++ b/quamash/__init__.py
@@ -347,7 +347,7 @@ class QEventLoop(_baseclass):
notifier.setEnabled(True)
self._logger.debug('Adding reader callback for file descriptor {}'.format(fd))
notifier.activated.connect(
- lambda: self.__on_notifier_ready(notifier, callback, args)
+ lambda: self.__on_notifier_ready(notifier, fd, callback, args)
)
self._read_notifiers[fd] = notifier
@@ -369,7 +369,7 @@ class QEventLoop(_baseclass):
notifier.setEnabled(True)
self._logger.debug('Adding writer callback for file descriptor {}'.format(fd))
notifier.activated.connect(
- lambda: self.__on_notifier_ready(notifier, callback, args)
+ lambda: self.__on_notifier_ready(notifier, fd, callback, args)
)
self._write_notifiers[fd] = notifier
@@ -385,11 +385,19 @@ class QEventLoop(_baseclass):
else:
notifier.setEnabled(False)
- @staticmethod
- def __on_notifier_ready(notifier, callback, args):
+ def __on_notifier_ready(self, notifier, fd, callback, args):
# It can be necessary to disable QSocketNotifier when e.g. checking
# ZeroMQ sockets for events
+ if fd not in self._read_notifiers and fd not in self._write_notifiers:
+ self._logger.warning(
+ 'Socket notifier for fd {} is ready, even though it should be disabled, not calling {}'
+ .format(fd, callback)
+ )
+ return
+
enabled = notifier.isEnabled()
+ assert enabled
+ self._logger.debug('Socket notifier for fd {} is ready'.format(fd))
notifier.setEnabled(False)
try:
callback(*args)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/python-quamash.git
More information about the Pkg-bitcoin-commits
mailing list