File indexing completed on 2025-01-05 04:37:11
0001 /* 0002 SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef DHTNODELOOKUP_H 0007 #define DHTNODELOOKUP_H 0008 0009 #include "key.h" 0010 #include "task.h" 0011 0012 namespace dht 0013 { 0014 class Node; 0015 class RPCServer; 0016 0017 /** 0018 * @author Joris Guisson <joris.guisson@gmail.com> 0019 * 0020 * Task to do a node lookup. 0021 */ 0022 class NodeLookup : public Task 0023 { 0024 public: 0025 NodeLookup(const dht::Key &node_id, RPCServer *rpc, Node *node, QObject *parent); 0026 ~NodeLookup() override; 0027 0028 void update() override; 0029 void callFinished(RPCCall *c, RPCMsg::Ptr rsp) override; 0030 void callTimeout(RPCCall *c) override; 0031 0032 private: 0033 void handleNodes(const QByteArray &nodes, int ip_version); 0034 0035 private: 0036 dht::Key node_id; 0037 bt::Uint32 num_nodes_rsp; 0038 }; 0039 0040 } 0041 0042 #endif