improved uploading and fixed announce

master
Kevin Froman 2019-01-28 16:49:04 -06:00
parent e60503771e
commit 4882a21b6a
3 changed files with 8 additions and 4 deletions

View File

@ -436,4 +436,9 @@ class API:
return False
def getUptime(self):
return self._utils.getEpoch() - self.startTime
while True:
try:
return self._utils.getEpoch - startTime
except AttributeError:
# Don't error on race condition with startup
pass

View File

@ -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)

View File

@ -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: