From c3edba7534d86b7cfb44eca0cf34a949876e4230 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 13 Jul 2017 15:57:43 -0700 Subject: udp: Modify log messages of UDP transport - Remove multi-line log message for socket creation - Include local addr and port in trace messages --- host/lib/transport/udp_wsa_zero_copy.cpp | 20 +++++++++++++++----- host/lib/transport/udp_zero_copy.cpp | 17 ++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) (limited to 'host') diff --git a/host/lib/transport/udp_wsa_zero_copy.cpp b/host/lib/transport/udp_wsa_zero_copy.cpp index 68e94d319..4d054f2e0 100644 --- a/host/lib/transport/udp_wsa_zero_copy.cpp +++ b/host/lib/transport/udp_wsa_zero_copy.cpp @@ -197,7 +197,10 @@ public: check_registry_for_fast_send_threshold(this->get_send_frame_size()); #endif /*CHECK_REG_SEND_THRESH*/ - UHD_LOGGER_INFO("UDP") << boost::format("Creating WSA UDP transport for %s:%s") % addr % port ; + UHD_LOGGER_TRACE("UDP") + << boost::format("Creating WSA UDP transport to %s:%s") + % addr % port; + static uhd_wsa_control uhd_wsa; //makes wsa start happen via lazy initialization UHD_ASSERT_THROW(_num_send_frames <= WSA_MAXIMUM_WAIT_EVENTS); @@ -233,6 +236,10 @@ public: throw uhd::os_error(str(boost::format("WSAConnect() failed with error %d") % error)); } + UHD_LOGGER_TRACE("UDP") + << boost::format("Local WSA UDP socket endpoint: %s:%s") + % get_local_addr() % get_local_port(); + //allocate re-usable managed receive buffers for (size_t i = 0; i < get_num_recv_frames(); i++){ _mrb_pool.push_back(boost::shared_ptr( @@ -275,6 +282,7 @@ public: size_t get_num_send_frames(void) const {return _num_send_frames;} size_t get_send_frame_size(void) const {return _send_frame_size;} + uint16_t get_local_port(void) const { struct sockaddr_in addr_info; int addr_len = sizeof(addr_info); @@ -352,10 +360,12 @@ void check_usr_buff_size( size_t user_buff_size, // Set this to zero for no user-defined preference const std::string tx_rx ){ - UHD_LOGGER_DEBUG("UDP") << boost::format( - "Target %s sock buff size: %d bytes\n" - "Actual %s sock buff size: %d bytes" - ) % tx_rx % user_buff_size % tx_rx % actual_buff_size ; + UHD_LOGGER_DEBUG("UDP") + << boost::format("Target/actual %s sock buff size: %d/%d bytes") + % tx_rx + % user_buff_size + % actual_buff_size + ; if ((user_buff_size != 0.0) and (actual_buff_size < user_buff_size)) UHD_LOGGER_WARNING("UDP") << boost::format( "The %s buffer could not be resized sufficiently.\n" "Target sock buff size: %d bytes.\n" diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index cd271eccf..e9d8c3172 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -175,7 +175,8 @@ public: _send_buffer_pool(buffer_pool::make(xport_params.num_send_frames, xport_params.send_frame_size)), _next_recv_buff_index(0), _next_send_buff_index(0) { - UHD_LOGGER_TRACE("UDP") << boost::format("Creating udp transport for %s %s") % addr % port ; + UHD_LOGGER_TRACE("UDP") + << boost::format("Creating UDP transport to %s:%s") % addr % port; #ifdef CHECK_REG_SEND_THRESH check_registry_for_fast_send_threshold(this->get_send_frame_size()); @@ -192,6 +193,10 @@ public: _socket->connect(receiver_endpoint); _sock_fd = _socket->native(); + UHD_LOGGER_TRACE("UDP") + << boost::format("Local UDP socket endpoint: %s:%s") + % get_local_addr() % get_local_port(); + //allocate re-usable managed receive buffers for (size_t i = 0; i < get_num_recv_frames(); i++){ _mrb_pool.push_back(boost::make_shared( @@ -289,10 +294,12 @@ template static size_t resize_buff_helper( //resize the buffer if size was provided if (target_size > 0){ actual_size = udp_trans->resize_buff(target_size); - UHD_LOGGER_DEBUG("UDP") << boost::format( - "Target %s sock buff size: %d bytes\n" - "Actual %s sock buff size: %d bytes" - ) % name % target_size % name % actual_size ; + UHD_LOGGER_DEBUG("UDP") + << boost::format("Target/actual %s sock buff size: %d/%d bytes") + % name + % target_size + % actual_size + ; if (actual_size < target_size) UHD_LOGGER_WARNING("UDP") << boost::format( "The %s buffer could not be resized sufficiently.\n" "Target sock buff size: %d bytes.\n" -- cgit v1.2.3