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