From 92b0ad975fa56935afba75f1a9425fafe404090b Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 26 Jun 2018 00:26:01 -0500 Subject: [PATCH] + Now log running seconds in heartbeat * Do not spam "could not connect to any peer" if we have a peer connected --- onionr/communicator2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/onionr/communicator2.py b/onionr/communicator2.py index 98d1aecd..01103bb5 100755 --- a/onionr/communicator2.py +++ b/onionr/communicator2.py @@ -33,6 +33,7 @@ class OnionrCommunicatorDaemon: self.powSalt = 0 self.delay = 1 self.proxyPort = sys.argv[2] + self.startTime = self._core._utils.getEpoch() self.onlinePeers = [] self.offlinePeers = [] @@ -223,7 +224,8 @@ class OnionrCommunicatorDaemon: tried.append(address) logger.debug('failed to connect to ' + address) else: - logger.warn('Could not connect to any peer') + if len(self.onlinePeers) == 0: + logger.warn('Could not connect to any peer') return retData def printOnlinePeers(self): @@ -253,7 +255,8 @@ class OnionrCommunicatorDaemon: def heartbeat(self): '''Show a heartbeat debug message''' - logger.debug('Communicator heartbeat') + currentTime = self._core._utils.getEpoch() - self.startTime + logger.debug('heartbeat, running seconds: ' + str(currentTime)) self.decrementThreadCount('heartbeat') def daemonCommands(self):