From 27b156dd318f0daa7840c2ee6533399ee6a458f8 Mon Sep 17 00:00:00 2001 From: tftzee <49162693+rex-schilasky@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:21:10 +0200 Subject: [PATCH] remove unused and untested udp sendasync method --- ecal/core/src/io/udp_sender.cpp | 44 +-------------------------------- ecal/core/src/io/udp_sender.h | 4 +-- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/ecal/core/src/io/udp_sender.cpp b/ecal/core/src/io/udp_sender.cpp index 8c60d8c491..c0f968fa71 100644 --- a/ecal/core/src/io/udp_sender.cpp +++ b/ecal/core/src/io/udp_sender.cpp @@ -44,14 +44,9 @@ namespace eCAL { public: CUDPSenderImpl(const SSenderAttr& attr_); - - size_t Send (const void* buf_, size_t len_, const char* ipaddr_ = nullptr); - void SendAsync(const void* buf_, size_t len_, const char* ipaddr_ = nullptr); + size_t Send(const void* buf_, size_t len_, const char* ipaddr_ = nullptr); protected: - void SendAsync(asio::const_buffer buf_, const char* ipaddr_); - void OnSendAsync(asio::error_code ec_, std::size_t bytes_transferred_, asio::const_buffer buf_, const char* ipaddr_); - bool m_broadcast; bool m_unicast; asio::io_context m_iocontext; @@ -127,37 +122,6 @@ namespace eCAL return(sent); } - void CUDPSenderImpl::SendAsync(const void* buf_, const size_t len_, const char* ipaddr_) - { - SendAsync(asio::buffer(buf_, len_), ipaddr_); - m_iocontext.run(); - } - - void CUDPSenderImpl::SendAsync(asio::const_buffer buf_, const char* ipaddr_) - { - if ((ipaddr_ != nullptr) && (ipaddr_[0] != '\0')) m_socket.async_send_to(buf_, asio::ip::udp::endpoint(asio::ip::make_address(ipaddr_), m_port), std::bind(&CUDPSenderImpl::OnSendAsync, this, std::placeholders::_1, std::placeholders::_2, buf_, ipaddr_)); - else m_socket.async_send_to(buf_, m_endpoint, std::bind(&CUDPSenderImpl::OnSendAsync, this, std::placeholders::_1, std::placeholders::_2, buf_, ipaddr_)); - } - - void CUDPSenderImpl::OnSendAsync(asio::error_code ec_, std::size_t bytes_transferred_, asio::const_buffer buf_, const char* ipaddr_) - { - if (!ec_) - { - // bytes_transferred_ amount of data was successfully sent - auto bytes_left = buf_ + bytes_transferred_; - if (bytes_left.size() != 0u) - { - // send "rest data" in the next SendAsync operation - SendAsync(bytes_left, ipaddr_); - } - m_iocontext.stop(); - } - else - { - std::cout << "CUDPSender::OnSend failed with: \'" << ec_.message() << "\'" << std::endl; - } - } - //////////////////////////////////////////////////////// // udp sender class //////////////////////////////////////////////////////// @@ -171,10 +135,4 @@ namespace eCAL if (!m_socket_impl) return(0); return(m_socket_impl->Send(buf_, len_, ipaddr_)); } - - void CUDPSender::SendAsync(const void* buf_, const size_t len_, const char* ipaddr_) - { - if (!m_socket_impl) return; - m_socket_impl->SendAsync(buf_, len_, ipaddr_); - } } diff --git a/ecal/core/src/io/udp_sender.h b/ecal/core/src/io/udp_sender.h index 0440cedc82..5797ee181d 100644 --- a/ecal/core/src/io/udp_sender.h +++ b/ecal/core/src/io/udp_sender.h @@ -45,9 +45,7 @@ namespace eCAL { public: CUDPSender(const SSenderAttr& attr_); - - size_t Send (const void* buf_, size_t len_, const char* ipaddr_ = nullptr); - void SendAsync(const void* buf_, size_t len_, const char* ipaddr_ = nullptr); + size_t Send(const void* buf_, size_t len_, const char* ipaddr_ = nullptr); protected: std::shared_ptr m_socket_impl;