[Pkg-bitcoin-commits] [python-quamash] 160/269: fix #8 - Linux test failures on linux
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 14310f85a59f651dc7fe00f02ffc32643df90bf1
Author: Mark Harviston <mark.harviston at gmail.com>
Date: Sun Dec 14 02:43:37 2014 -0800
fix #8 - Linux test failures on linux
default/builtin _add_callback_signalsafe is perfectly adequate
must disable invalid notifiers or they clog up the event loop
---
quamash/__init__.py | 12 ++++++------
quamash/_unix.py | 23 -----------------------
2 files changed, 6 insertions(+), 29 deletions(-)
diff --git a/quamash/__init__.py b/quamash/__init__.py
index 422866d..bfca2c7 100644
--- a/quamash/__init__.py
+++ b/quamash/__init__.py
@@ -386,23 +386,23 @@ class QEventLoop(_baseclass):
notifier.setEnabled(False)
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 {}'
+ 'Socket notifier for fd {} is ready, even though it should be disabled, not calling {} and disabling'
.format(fd, callback)
)
+ notifier.setEnabled(False)
return
- enabled = notifier.isEnabled()
- assert enabled
+ # It can be necessary to disable QSocketNotifier when e.g. checking
+ # ZeroMQ sockets for events
+ assert notifier.isEnabled()
self._logger.debug('Socket notifier for fd {} is ready'.format(fd))
notifier.setEnabled(False)
try:
callback(*args)
finally:
- notifier.setEnabled(enabled)
+ notifier.setEnabled(True)
# Methods for interacting with threads.
diff --git a/quamash/_unix.py b/quamash/_unix.py
index e12325a..320cdd6 100644
--- a/quamash/_unix.py
+++ b/quamash/_unix.py
@@ -187,10 +187,6 @@ class _SelectorEventLoop(asyncio.SelectorEventLoop):
selector = _Selector(self)
asyncio.SelectorEventLoop.__init__(self, selector)
- socket_notifier = self.__socket_notifier = QtCore.QSocketNotifier(
- self._ssock.fileno(), QtCore.QSocketNotifier.Read)
- socket_notifier.activated.connect(self.__wake_on_socket)
-
def _before_run_forever(self):
pass
@@ -214,23 +210,4 @@ class _SelectorEventLoop(asyncio.SelectorEventLoop):
self._logger.debug('Invoking writer callback: {}'.format(writer))
writer._run()
- def _add_callback_signalsafe(self, handle):
- """Add callback in signal safe manner."""
- self._signal_safe_callbacks.append(handle)
- self._write_to_self()
-
- def __wake_on_socket(self):
- self._logger.debug('Waking on socket notification, {} signal callback(s) waiting'.format(
- len(self._signal_safe_callbacks)
- ))
-
- if self._ssock is not None:
- # Acknowledge command
- self._ssock.recv(1)
- for handle in self._signal_safe_callbacks[:]:
- self._logger.debug('Scheduling signal callback {}'.format(handle))
- self._signal_safe_callbacks.remove(handle)
- self._add_callback(handle)
-
-
baseclass = _SelectorEventLoop
--
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