diff options
-rw-r--r-- | src/packetSource.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
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<proto::socket*>::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; } |