communicator db responses probably finished
parent
aeb9a6e775
commit
c5a0b29988
|
@ -296,10 +296,13 @@ class API:
|
|||
|
||||
@app.route('/queueResponse/<name>')
|
||||
def queueResponse(name):
|
||||
try:
|
||||
res = self.queueResponse[name]
|
||||
except KeyError:
|
||||
resp = ''
|
||||
try:
|
||||
resp = self.queueResponse[name]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
del self.queueResponse[name]
|
||||
return Response(resp)
|
||||
|
||||
@app.route('/ping')
|
||||
|
|
|
@ -507,9 +507,10 @@ class OnionrCommunicatorDaemon:
|
|||
else:
|
||||
logger.info('Recieved daemonQueue command:' + cmd[0])
|
||||
|
||||
if cmd[4] != '':
|
||||
if cmd[4] != '' and cmd[0] not in ('', None):
|
||||
if response != '':
|
||||
self._core._utils.localCommand('queueResponseAdd', data='/' + cmd[4], post=True, postData=response)
|
||||
self._core._utils.localCommand('queueResponseAdd/' + cmd[4], post=True, postData={'data': response})
|
||||
response = ''
|
||||
|
||||
self.decrementThreadCount('daemonCommands')
|
||||
|
||||
|
|
|
@ -384,7 +384,8 @@ class Core:
|
|||
Get a response sent by communicator to the API, by requesting to the API
|
||||
'''
|
||||
assert len(responseID) > 0
|
||||
resp = self._utils.localCommand('queueResponse', data='/' + responseID, post=True)
|
||||
resp = self._utils.localCommand('queueResponse/' + responseID)
|
||||
return resp
|
||||
|
||||
def clearDaemonQueue(self):
|
||||
'''
|
||||
|
|
|
@ -397,8 +397,12 @@ class Onionr:
|
|||
randID = str(uuid.uuid4())
|
||||
self.onionrCore.daemonQueueAdd('connectedPeers', responseID=randID)
|
||||
while True:
|
||||
time.sleep(1)
|
||||
try:
|
||||
time.sleep(3)
|
||||
peers = self.onionrCore.daemonQueueGetResponse(randID)
|
||||
except KeyboardInterrupt:
|
||||
break
|
||||
if not type(peers) is None:
|
||||
if peers not in ('', None):
|
||||
print(peers)
|
||||
break
|
||||
|
|
|
@ -173,7 +173,6 @@ class OnionrUtils:
|
|||
if data != '':
|
||||
data = '&data=' + urllib.parse.quote_plus(data)
|
||||
payload = 'http://%s:%s/%s%s' % (hostname, config.get('client.client.port'), command, data)
|
||||
|
||||
try:
|
||||
if post:
|
||||
retData = requests.post(payload, data=postData, headers={'token': config.get('client.webpassword')}).text
|
||||
|
|
Loading…
Reference in New Issue