aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-13 15:41:55 -0400
committerDeterminant <[email protected]>2019-06-13 15:41:55 -0400
commitd164d2d4535468bf695ff6c0f277486e6016e586 (patch)
treeebc02013c56dd791a422120966a1147c4a4fd09e /include
parent4de5d8f054a6a34efe70f1e01297136e8a84c08b (diff)
change test_p2p example; fix bugs
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/network.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/salticidae/network.h b/include/salticidae/network.h
index b119e78..14d270f 100644
--- a/include/salticidae/network.h
+++ b/include/salticidae/network.h
@@ -598,7 +598,13 @@ bool PeerNetwork<O, _, __>::check_new_conn(const conn_t &conn, uint16_t port) {
conn->peer_id.ip = conn->get_addr().ip;
conn->peer_id.port = port;
}
- auto p = id2peer.find(conn->peer_id)->second.get();
+ auto it = id2peer.find(conn->peer_id);
+ if (it == id2peer.end())
+ {
+ conn->disp_terminate();
+ return true;
+ }
+ auto p = it->second.get();
if (p->connected)
{
if (conn != p->conn)