Merge branch 'uploadwait2' into 'master'

Merge Uploadwait2

See merge request beardog/Onionr!13
master
Kevin 2018-11-16 22:34:54 +00:00
commit 7f0365c66d
2 changed files with 9 additions and 4 deletions

View File

@ -403,7 +403,7 @@ class OnionrCommunicatorDaemon:
'''Perform a get request to a peer'''
if len(peer) == 0:
return False
logger.info('Performing ' + action + ' with ' + peer + ' on port ' + str(self.proxyPort))
#logger.debug('Performing ' + action + ' with ' + peer + ' on port ' + str(self.proxyPort))
url = 'http://' + peer + '/public/?action=' + action
if len(data) > 0:
url += '&data=' + data
@ -493,6 +493,7 @@ class OnionrCommunicatorDaemon:
for bl in self.blocksToUpload:
if not self._core._utils.validateHash(bl):
logger.warn('Requested to upload invalid block')
self.decrementThreadCount('uploadBlock')
return
for i in range(max(len(self.onlinePeers), 2)):
peer = self.pickOnlinePeer()
@ -506,12 +507,16 @@ class OnionrCommunicatorDaemon:
proxyType = 'tor'
elif peer.endswith('.i2p'):
proxyType = 'i2p'
logger.info("Uploading block")
logger.info("Uploading block to " + peer)
if not self._core._utils.doPostRequest(url, data=data, proxyType=proxyType) == False:
self._core._utils.localCommand('waitForShare', data=bl)
finishedUploads.append(bl)
break
for x in finishedUploads:
try:
self.blocksToUpload.remove(x)
except ValueError:
pass
self.decrementThreadCount('uploadBlock')
def announce(self, peer):

View File

@ -276,7 +276,7 @@ class OnionrUtils:
if myBlock.getMetadata('newFSKey') is not None:
onionrusers.OnionrUser(self._core, signer).addForwardKey(myBlock.getMetadata('newFSKey'))
else:
logger.warn('FS not used for this encrypted block')
logger.debug('FS not used for this block')
logger.info(myBlock.bmetadata)
try: