diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-07-13 15:57:43 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-10-04 14:58:41 -0700 |
commit | c3edba7534d86b7cfb44eca0cf34a949876e4230 (patch) | |
tree | 50c30693db51ff6b38245cd534f5025ffff07117 /host/lib/transport | |
parent | ad1e0bc855cfa418f1a297c64e44a8352e80c4ee (diff) | |
download | uhd-c3edba7534d86b7cfb44eca0cf34a949876e4230.tar.gz uhd-c3edba7534d86b7cfb44eca0cf34a949876e4230.tar.bz2 uhd-c3edba7534d86b7cfb44eca0cf34a949876e4230.zip |
udp: Modify log messages of UDP transport
- Remove multi-line log message for socket creation
- Include local addr and port in trace messages
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/udp_wsa_zero_copy.cpp | 20 | ||||
-rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 17 |
2 files changed, 27 insertions, 10 deletions
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<udp_zero_copy_asio_mrb>( @@ -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<udp_zero_copy_asio_mrb>( @@ -289,10 +294,12 @@ template<typename Opt> static size_t resize_buff_helper( //resize the buffer if size was provided if (target_size > 0){ actual_size = udp_trans->resize_buff<Opt>(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" |