From 8f5a8ab8ba4420debf8e8e110ff74936221704df Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Sat, 2 Feb 2019 02:02:19 -0500 Subject: [PATCH] fix peer_ping --- lbrynet/extras/daemon/Daemon.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 9a55b7d8d..9c9946be3 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -2798,18 +2798,14 @@ class Daemon(metaclass=JSONRPCServerType): """ peer = None if node_id and address and port: - peer = self.component_manager.peer_manager.get_peer(address, unhexlify(node_id), udp_port=int(port)) - if not peer: - peer = self.component_manager.peer_manager.make_peer( - address, unhexlify(node_id), udp_port=int(port) - ) + peer = self.component_manager.peer_manager.get_kademlia_peer(unhexlify(node_id), address, + udp_port=int(port)) + try: + return await self.dht_node.protocol.get_rpc_peer(peer).ping() + except asyncio.TimeoutError: + return {'error': 'timeout'} if not peer: return {'error': 'peer not found'} - try: - result = await peer.ping() - return result.decode() - except asyncio.TimeoutError: - return {'error': 'ping timeout'} @requires(DHT_COMPONENT) def jsonrpc_routing_table_get(self):