From 53c1165645ad4fa29fbab68440a69881922c28f4 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 25 Feb 2020 16:16:15 -0500 Subject: add get_peer_id() func to Conn --- include/salticidae/network.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/salticidae/network.h b/include/salticidae/network.h index 6a9b8cf..03252b4 100644 --- a/include/salticidae/network.h +++ b/include/salticidae/network.h @@ -372,6 +372,14 @@ class PeerNetwork: public MsgNetwork { return ret; } + PeerId get_peer_id() { + auto ret = *(static_cast( + get_net()->disp_tcall->call([this](ThreadCall::Handle &h) { + h.set_result(peer ? PeerId(peer->id) : PeerId()); + }).get())); + return ret; + } + PeerNetwork *get_net() { return static_cast(ConnPool::Conn::get_pool()); } -- cgit v1.2.3-70-g09d2