diff options
author | Determinant <[email protected]> | 2020-02-25 16:16:15 -0500 |
---|---|---|
committer | Determinant <[email protected]> | 2020-02-25 16:16:15 -0500 |
commit | 53c1165645ad4fa29fbab68440a69881922c28f4 (patch) | |
tree | a78304629d61e8ebe4f6080dea71fbe3a101d368 | |
parent | d6885c510e1c3f142d00cbd8bf65bbc4dc44b195 (diff) |
add get_peer_id() func to Conn
-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()); } |