diff --git a/onionr/api.py b/onionr/api.py index b0a6c8b6..f5ba9c81 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -436,4 +436,9 @@ class API: return False def getUptime(self): - return self._utils.getEpoch() - self.startTime \ No newline at end of file + while True: + try: + return self._utils.getEpoch - startTime + except AttributeError: + # Don't error on race condition with startup + pass \ No newline at end of file diff --git a/onionr/communicator.py b/onionr/communicator.py index 8ba63c32..1b8dc7fd 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -574,7 +574,7 @@ class OnionrCommunicatorDaemon: logger.warn('Requested to upload invalid block') self.decrementThreadCount('uploadBlock') return - for i in range(max(len(self.onlinePeers), 2)): + for i in range(min(len(self.onlinePeers), 6)): peer = self.pickOnlinePeer() if peer in triedPeers: continue @@ -590,7 +590,6 @@ class OnionrCommunicatorDaemon: if not self._core._utils.doPostRequest(url, data=data, proxyType=proxyType) == False: self._core._utils.localCommand('waitforshare/' + bl) finishedUploads.append(bl) - break for x in finishedUploads: try: self.blocksToUpload.remove(x) diff --git a/onionr/onionrdaemontools.py b/onionr/onionrdaemontools.py index 7e7c8ec7..faea0070 100644 --- a/onionr/onionrdaemontools.py +++ b/onionr/onionrdaemontools.py @@ -34,7 +34,7 @@ class DaemonTools: '''Announce our node to our peers''' retData = False announceFail = False - if self.daemon._core.config('general.security_level') == 0: + if self.daemon._core.config.get('general.security_level', 0) == 0: # Announce to random online peers for i in self.daemon.onlinePeers: if not i in self.announceCache: