diff options
author | Determinant <ted.sybil@gmail.com> | 2018-11-18 00:51:19 -0500 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2018-11-18 00:51:19 -0500 |
commit | 39f6d6ac46d440aa68e7b1a2f2e4eb629356af34 (patch) | |
tree | 164e42004f26ce3295d3cbb8a5870039f4c4165b /include/salticidae/conn.h | |
parent | e12e559e85b0c2615fb550cc11560350517efca6 (diff) |
fix bugs
Diffstat (limited to 'include/salticidae/conn.h')
-rw-r--r-- | include/salticidae/conn.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/salticidae/conn.h b/include/salticidae/conn.h index 69402d3..c357875 100644 --- a/include/salticidae/conn.h +++ b/include/salticidae/conn.h @@ -63,7 +63,7 @@ class ConnPool { /** The handle to a bi-directional connection. */ using conn_t = ArcObj<Conn>; /** The type of callback invoked when connection status is changed. */ - using conn_callback_t = std::function<void(Conn &, bool)>; + using conn_callback_t = std::function<void(const conn_t &, bool)>; /** Abstraction for a bi-directional connection. */ class Conn { friend ConnPool; @@ -168,7 +168,7 @@ class ConnPool { void update_conn(const conn_t &conn, bool connected) { user_tcall->async_call([this, conn, connected](ThreadCall::Handle &) { - if (conn_cb) conn_cb(*conn, connected); + if (conn_cb) conn_cb(conn, connected); }); } @@ -391,9 +391,7 @@ class ConnPool { template<typename Func> void reg_conn_handler(Func cb) { conn_cb = cb; } - void terminate(Conn &_conn) { - auto conn = _conn.self(); - if (!conn) return; + void terminate(const conn_t &conn) { disp_tcall->async_call([this, conn](ThreadCall::Handle &) { conn->disp_terminate(); }); |