From a4ddef25a1a585349079e7171bdaa7686272e90a Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 28 May 2018 05:05:43 +0100 Subject: [PATCH] core: move reader/writer debug prints They stop working with kqueue/epoll poller in the old location. Also comment them out again, should never have been checked in uncommented. --- mitogen/core.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index f98fc8d2..7f2339a4 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -297,9 +297,11 @@ def enable_debug_logging(): _profile_hook = lambda name, func, *args: func(*args) + def enable_profiling(): global _profile_hook - import cProfile, pstats + import cProfile + import pstats def _profile_hook(name, func, *args): profiler = cProfile.Profile() profiler.enable() @@ -1071,8 +1073,6 @@ class Poller(object): def poll(self, timeout=None): _vv and IOLOG.debug('%r.poll(%r)', self, timeout) - IOLOG.debug('readers = %r', self._rfds) - IOLOG.debug('writers = %r', self._wfds) (rfds, wfds, _), _ = io_op(select.select, self._rfds, self._wfds, @@ -1427,7 +1427,7 @@ class Router(object): refused_msg = 'Refused by policy.' def _invoke(self, msg, stream): - #IOLOG.debug('%r._invoke(%r)', self, msg) + # IOLOG.debug('%r._invoke(%r)', self, msg) try: persist, fn, policy = self._handle_map[msg.handle] except KeyError: @@ -1566,7 +1566,10 @@ class Broker(object): stream.on_disconnect(self) def _loop_once(self, timeout=None): - _vv and IOLOG.debug('%r._loop_once(%r)', self, timeout) + _vv and IOLOG.debug('%r._loop_once(%r, %r)', + self, timeout, self.poller) + #IOLOG.debug('readers =\n%s', pformat(self.poller.readers)) + #IOLOG.debug('writers =\n%s', pformat(self.poller.writers)) for (side, func) in self.poller.poll(timeout): self._call(side.stream, func)