Add response on socket
This commit is contained in:
parent
9cd89f4a83
commit
dab50dadd1
@ -99,9 +99,10 @@ signal.signal(signal.SIGTERM, ctrl.shutdown)
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
while True:
|
while True:
|
||||||
r = None
|
v = None
|
||||||
|
client_socket = None
|
||||||
try:
|
try:
|
||||||
r = ctrl.get()
|
(client_socket, v) = ctrl.get()
|
||||||
except ClientGoneError:
|
except ClientGoneError:
|
||||||
break
|
break
|
||||||
except ClientBlockError:
|
except ClientBlockError:
|
||||||
@ -111,21 +112,26 @@ def main():
|
|||||||
except NothingToDoError:
|
except NothingToDoError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if r == None:
|
if v == None:
|
||||||
ctrl.process(conn)
|
ctrl.process(conn)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
result_data = None
|
||||||
|
r = 0 # no error
|
||||||
try:
|
try:
|
||||||
tx_hash = queue_adapter.put(r.hex())
|
result_data = queue_adapter.put(v.hex())
|
||||||
except DuplicateTxError as e:
|
except DuplicateTxError as e:
|
||||||
logg.error('tx already exists as {}'.format(e))
|
logg.error('tx already exists: {}'.format(e))
|
||||||
continue
|
r = 1
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logg.error('adapter rejected input {}: "{}"'.format(r.hex(), e))
|
logg.error('adapter rejected input {}: "{}"'.format(v.hex(), e))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
queue_adapter.enqueue(tx_hash)
|
if r == 0:
|
||||||
|
queue_adapter.enqueue(result_data)
|
||||||
|
|
||||||
|
ctrl.respond_put(client_socket, r, extra_data=result_data)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -6,5 +6,5 @@ After=chaind-eth-sync@.service
|
|||||||
[Service]
|
[Service]
|
||||||
Environment="SESSION_ID=%i"
|
Environment="SESSION_ID=%i"
|
||||||
Environment="SESSION_RUNTIME_DIR=/run/user/%U/chaind/eth"
|
Environment="SESSION_RUNTIME_DIR=/run/user/%U/chaind/eth"
|
||||||
ExecStart=%h/.local/bin/chaind-eth-server -v --session-id %i
|
ExecStart=%h/.local/bin/chaind-eth-tasker -v --session-id %i
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
Loading…
Reference in New Issue
Block a user