diff options
author | Determinant <[email protected]> | 2019-06-29 17:33:34 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-29 17:33:34 -0400 |
commit | b06eef583fb9084f29e416a1af7555de4a73f764 (patch) | |
tree | 6a31770308ca55125750561f114cc7e765f19cce /src | |
parent | 5f617d88a399f276133b4187eb31ca49e5f1338a (diff) |
...
Diffstat (limited to 'src')
-rw-r--r-- | src/conn.cpp | 1 | ||||
-rw-r--r-- | src/network.cpp | 18 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/conn.cpp b/src/conn.cpp index f26c480..abea7ac 100644 --- a/src/conn.cpp +++ b/src/conn.cpp @@ -408,7 +408,6 @@ void ConnPool::del_conn(const conn_t &conn) { pool.erase(it); update_conn(conn, false); release_conn(conn); - //std::atomic_thread_fence(std::memory_order_release); } void ConnPool::release_conn(const conn_t &conn) { diff --git a/src/network.cpp b/src/network.cpp index 5b0018c..e604eaa 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -235,8 +235,13 @@ netaddr_t *peernetwork_conn_get_peer_addr(const peernetwork_conn_t *self) { void peernetwork_conn_free(const peernetwork_conn_t *self) { delete self; } -void peernetwork_send_msg(peernetwork_t *self, const msg_t * msg, const netaddr_t *addr) { - self->_send_msg(*msg, *addr); +bool peernetwork_send_msg(peernetwork_t *self, const msg_t * msg, const netaddr_t *addr) { + try { + self->_send_msg(*msg, *addr); + return true; + } catch (...) { + return false; + } } void peernetwork_send_msg_deferred_by_move(peernetwork_t *self, @@ -300,8 +305,13 @@ clientnetwork_conn_t *clientnetwork_conn_copy(const clientnetwork_conn_t *self) void clientnetwork_conn_free(const clientnetwork_conn_t *self) { delete self; } -void clientnetwork_send_msg(clientnetwork_t *self, const msg_t * msg, const netaddr_t *addr) { - self->_send_msg(*msg, *addr); +bool clientnetwork_send_msg(clientnetwork_t *self, const msg_t * msg, const netaddr_t *addr) { + try { + self->_send_msg(*msg, *addr); + return true; + } catch (...) { + return false; + } } void clientnetwork_send_msg_deferred_by_move(clientnetwork_t *self, msg_t *_moved_msg, const netaddr_t *addr) { |