improved uploading and fixed announce

This commit is contained in:
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 return False
def getUptime(self): 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') logger.warn('Requested to upload invalid block')
self.decrementThreadCount('uploadBlock') self.decrementThreadCount('uploadBlock')
return return
for i in range(max(len(self.onlinePeers), 2)): for i in range(min(len(self.onlinePeers), 6)):
peer = self.pickOnlinePeer() peer = self.pickOnlinePeer()
if peer in triedPeers: if peer in triedPeers:
continue continue
@ -590,7 +590,6 @@ class OnionrCommunicatorDaemon:
if not self._core._utils.doPostRequest(url, data=data, proxyType=proxyType) == False: if not self._core._utils.doPostRequest(url, data=data, proxyType=proxyType) == False:
self._core._utils.localCommand('waitforshare/' + bl) self._core._utils.localCommand('waitforshare/' + bl)
finishedUploads.append(bl) finishedUploads.append(bl)
break
for x in finishedUploads: for x in finishedUploads:
try: try:
self.blocksToUpload.remove(x) self.blocksToUpload.remove(x)

View File

@ -34,7 +34,7 @@ class DaemonTools:
'''Announce our node to our peers''' '''Announce our node to our peers'''
retData = False retData = False
announceFail = 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 # Announce to random online peers
for i in self.daemon.onlinePeers: for i in self.daemon.onlinePeers:
if not i in self.announceCache: if not i in self.announceCache: