aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-02-25 16:16:15 -0500
committerDeterminant <[email protected]>2020-02-25 16:16:15 -0500
commit53c1165645ad4fa29fbab68440a69881922c28f4 (patch)
treea78304629d61e8ebe4f6080dea71fbe3a101d368 /include
parentd6885c510e1c3f142d00cbd8bf65bbc4dc44b195 (diff)
add get_peer_id() func to Conn
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/network.h8
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());
}