From 59a96801ec580094be2c20a0e0d9f10232a8f26f Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Wed, 14 Dec 2011 03:16:36 -0500 Subject: [PATCH] only display missing type/handler warnings in debug mode --- p2pool/bitcoin/p2p.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/p2pool/bitcoin/p2p.py b/p2pool/bitcoin/p2p.py index ea29b82..7cc149e 100644 --- a/p2pool/bitcoin/p2p.py +++ b/p2pool/bitcoin/p2p.py @@ -12,6 +12,7 @@ import time from twisted.internet import defer, protocol, reactor, task from twisted.python import log +import p2pool from . import data as bitcoin_data, getwork from p2pool.util import variable, datachunker, deferral, forest @@ -49,7 +50,8 @@ class BaseProtocol(protocol.Protocol): type_ = getattr(self, 'message_' + command, None) if type_ is None: - print 'no type for', repr(command) + if p2pool.DEBUG: + print 'no type for', repr(command) continue try: @@ -61,7 +63,8 @@ class BaseProtocol(protocol.Protocol): handler = getattr(self, 'handle_' + command, None) if handler is None: - print 'no handler for', repr(command) + if p2pool.DEBUG: + print 'no handler for', repr(command) continue try: -- 1.7.1