From d164d2d4535468bf695ff6c0f277486e6016e586 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 13 Jun 2019 15:41:55 -0400 Subject: change test_p2p example; fix bugs --- include/salticidae/network.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') 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::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) -- cgit v1.2.3-70-g09d2