summaryrefslogtreecommitdiff
path: root/src/packetSource.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2010-01-08 04:41:56 +0000
committerChristian Pointner <equinox@anytun.org>2010-01-08 04:41:56 +0000
commit7448f4dc8245ca2512e088ba6f89ece9a38cb915 (patch)
treef35337dd8341bd403f78265efb5af7a8a5b9cd6e /src/packetSource.cpp
parentUDPPacketSource now opens one socket for each resolved endpoint (diff)
dispatching right socket for send to function
Diffstat (limited to 'src/packetSource.cpp')
-rw-r--r--src/packetSource.cpp9
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;
}