From 7448f4dc8245ca2512e088ba6f89ece9a38cb915 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 8 Jan 2010 04:41:56 +0000 Subject: dispatching right socket for send to function --- src/packetSource.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/packetSource.cpp') diff --git a/src/packetSource.cpp b/src/packetSource.cpp index 7c66d0f..3ab22c6 100644 --- a/src/packetSource.cpp +++ b/src/packetSource.cpp @@ -90,6 +90,13 @@ u_int32_t UDPPacketSource::recv(u_int8_t* buf, u_int32_t len, PacketSourceEndpoi void UDPPacketSource::send(u_int8_t* buf, u_int32_t len, PacketSourceEndpoint remote) { - sockets_.front()->send_to(boost::asio::buffer(buf, len), remote); + std::list::iterator it = sockets_.begin(); + for(;it != sockets_.end(); ++it) { + if((*it)->local_endpoint().protocol() == remote.protocol()) { + (*it)->send_to(boost::asio::buffer(buf, len), remote); + return; + } + } + cLog.msg(Log::PRIO_WARNING) << "no suitable socket found for remote endpoint protocol: " << remote; } -- cgit v1.2.3