diff options
-rw-r--r-- | include/salticidae/network.h | 8 |
1 files changed, 8 insertions, 0 deletions
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<OpcodeType> { return ret; } + PeerId get_peer_id() { + auto ret = *(static_cast<PeerId *>( + 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<PeerNetwork *>(ConnPool::Conn::get_pool()); } |