From 5f617d88a399f276133b4187eb31ca49e5f1338a Mon Sep 17 00:00:00 2001 From: Determinant Date: Sat, 29 Jun 2019 16:35:20 -0400 Subject: ... --- include/salticidae/network.h | 2 ++ src/network.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/salticidae/network.h b/include/salticidae/network.h index 2b0c5b3..8372b9a 100644 --- a/include/salticidae/network.h +++ b/include/salticidae/network.h @@ -603,6 +603,7 @@ void PeerNetwork::on_setup(const ConnPool::conn_t &_conn) { MsgNet::on_setup(_conn); auto conn = static_pointer_cast(_conn); auto worker = conn->worker; + SALTICIDAE_LOG_INFO("connection: %s", std::string(*conn).c_str()); worker->get_tcall()->async_call([this, conn, worker](ThreadCall::Handle &) { auto &ev_timeout = conn->ev_timeout; assert(!ev_timeout); @@ -1261,6 +1262,7 @@ peernetwork_t *msgnetwork_as_peernetwork_unsafe(msgnetwork_t *self); msgnetwork_conn_t *msgnetwork_conn_new_from_peernetwork_conn(const peernetwork_conn_t *conn); peernetwork_conn_t *peernetwork_conn_new_from_msgnetwork_conn_unsafe(const msgnetwork_conn_t *conn); peernetwork_conn_t *peernetwork_conn_copy(const peernetwork_conn_t *self); +netaddr_t *peernetwork_conn_get_peer_addr(const peernetwork_conn_t *self); void peernetwork_conn_free(const peernetwork_conn_t *self); void peernetwork_send_msg(peernetwork_t *self, const msg_t * msg, const netaddr_t *addr); void peernetwork_send_msg_deferred_by_move(peernetwork_t *self, msg_t * _moved_msg, const netaddr_t *addr); diff --git a/src/network.cpp b/src/network.cpp index 78f653b..5b0018c 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -229,6 +229,10 @@ peernetwork_conn_t *peernetwork_conn_copy(const peernetwork_conn_t *self) { return new peernetwork_conn_t(*self); } +netaddr_t *peernetwork_conn_get_peer_addr(const peernetwork_conn_t *self) { + return new netaddr_t((*self)->get_peer_addr()); +} + 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) { -- cgit v1.2.3-70-g09d2