fix peer_ping
This commit is contained in:
parent
91e581422c
commit
8f5a8ab8ba
1 changed files with 6 additions and 10 deletions
|
@ -2798,18 +2798,14 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
"""
|
"""
|
||||||
peer = None
|
peer = None
|
||||||
if node_id and address and port:
|
if node_id and address and port:
|
||||||
peer = self.component_manager.peer_manager.get_peer(address, unhexlify(node_id), udp_port=int(port))
|
peer = self.component_manager.peer_manager.get_kademlia_peer(unhexlify(node_id), address,
|
||||||
if not peer:
|
udp_port=int(port))
|
||||||
peer = self.component_manager.peer_manager.make_peer(
|
try:
|
||||||
address, unhexlify(node_id), udp_port=int(port)
|
return await self.dht_node.protocol.get_rpc_peer(peer).ping()
|
||||||
)
|
except asyncio.TimeoutError:
|
||||||
|
return {'error': 'timeout'}
|
||||||
if not peer:
|
if not peer:
|
||||||
return {'error': 'peer not found'}
|
return {'error': 'peer not found'}
|
||||||
try:
|
|
||||||
result = await peer.ping()
|
|
||||||
return result.decode()
|
|
||||||
except asyncio.TimeoutError:
|
|
||||||
return {'error': 'ping timeout'}
|
|
||||||
|
|
||||||
@requires(DHT_COMPONENT)
|
@requires(DHT_COMPONENT)
|
||||||
def jsonrpc_routing_table_get(self):
|
def jsonrpc_routing_table_get(self):
|
||||||
|
|
Loading…
Reference in a new issue