Commit d8387f8f authored by Francis Dupont's avatar Francis Dupont

[#1234] Added a return for external sockets without handlers

parent 2b21ba10
...@@ -1091,12 +1091,14 @@ Pkt4Ptr IfaceMgr::receive4Indirect(uint32_t timeout_sec, uint32_t timeout_usec / ...@@ -1091,12 +1091,14 @@ Pkt4Ptr IfaceMgr::receive4Indirect(uint32_t timeout_sec, uint32_t timeout_usec /
// Let's find out which external socket has the data // Let's find out which external socket has the data
SocketCallbackInfo ex_sock; SocketCallbackInfo ex_sock;
bool found = false;
{ {
std::lock_guard<std::mutex> lock(callbacks_mutex_); std::lock_guard<std::mutex> lock(callbacks_mutex_);
BOOST_FOREACH(SocketCallbackInfo s, callbacks_) { BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
if (!FD_ISSET(s.socket_, &sockets)) { if (!FD_ISSET(s.socket_, &sockets)) {
continue; continue;
} }
found = true;
// something received over external socket // something received over external socket
if (s.callback_) { if (s.callback_) {
...@@ -1113,7 +1115,8 @@ Pkt4Ptr IfaceMgr::receive4Indirect(uint32_t timeout_sec, uint32_t timeout_usec / ...@@ -1113,7 +1115,8 @@ Pkt4Ptr IfaceMgr::receive4Indirect(uint32_t timeout_sec, uint32_t timeout_usec /
// layer access without integrating any specific features // layer access without integrating any specific features
// in IfaceMgr // in IfaceMgr
ex_sock.callback_(ex_sock.socket_); ex_sock.callback_(ex_sock.socket_);
}
if (found) {
return (Pkt4Ptr()); return (Pkt4Ptr());
} }
} }
...@@ -1199,12 +1202,14 @@ Pkt4Ptr IfaceMgr::receive4Direct(uint32_t timeout_sec, uint32_t timeout_usec /* ...@@ -1199,12 +1202,14 @@ Pkt4Ptr IfaceMgr::receive4Direct(uint32_t timeout_sec, uint32_t timeout_usec /*
// Let's find out which socket has the data // Let's find out which socket has the data
SocketCallbackInfo ex_sock; SocketCallbackInfo ex_sock;
bool found = false;
{ {
std::lock_guard<std::mutex> lock(callbacks_mutex_); std::lock_guard<std::mutex> lock(callbacks_mutex_);
BOOST_FOREACH(SocketCallbackInfo s, callbacks_) { BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
if (!FD_ISSET(s.socket_, &sockets)) { if (!FD_ISSET(s.socket_, &sockets)) {
continue; continue;
} }
found = true;
// something received over external socket // something received over external socket
if (s.callback_) { if (s.callback_) {
...@@ -1221,7 +1226,8 @@ Pkt4Ptr IfaceMgr::receive4Direct(uint32_t timeout_sec, uint32_t timeout_usec /* ...@@ -1221,7 +1226,8 @@ Pkt4Ptr IfaceMgr::receive4Direct(uint32_t timeout_sec, uint32_t timeout_usec /*
// layer access without integrating any specific features // layer access without integrating any specific features
// in IfaceMgr // in IfaceMgr
ex_sock.callback_(ex_sock.socket_); ex_sock.callback_(ex_sock.socket_);
}
if (found) {
return (Pkt4Ptr()); return (Pkt4Ptr());
} }
...@@ -1341,12 +1347,14 @@ IfaceMgr::receive6Direct(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ ) ...@@ -1341,12 +1347,14 @@ IfaceMgr::receive6Direct(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ )
// Let's find out which socket has the data // Let's find out which socket has the data
SocketCallbackInfo ex_sock; SocketCallbackInfo ex_sock;
bool found = false;
{ {
std::lock_guard<std::mutex> lock(callbacks_mutex_); std::lock_guard<std::mutex> lock(callbacks_mutex_);
BOOST_FOREACH(SocketCallbackInfo s, callbacks_) { BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
if (!FD_ISSET(s.socket_, &sockets)) { if (!FD_ISSET(s.socket_, &sockets)) {
continue; continue;
} }
found = true;
// something received over external socket // something received over external socket
if (s.callback_) { if (s.callback_) {
...@@ -1363,7 +1371,8 @@ IfaceMgr::receive6Direct(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ ) ...@@ -1363,7 +1371,8 @@ IfaceMgr::receive6Direct(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ )
// layer access without integrating any specific features // layer access without integrating any specific features
// in IfaceMgr // in IfaceMgr
ex_sock.callback_(ex_sock.socket_); ex_sock.callback_(ex_sock.socket_);
}
if (found) {
return (Pkt6Ptr()); return (Pkt6Ptr());
} }
...@@ -1471,12 +1480,14 @@ IfaceMgr::receive6Indirect(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ ...@@ -1471,12 +1480,14 @@ IfaceMgr::receive6Indirect(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
// Let's find out which external socket has the data // Let's find out which external socket has the data
SocketCallbackInfo ex_sock; SocketCallbackInfo ex_sock;
bool found = false;
{ {
std::lock_guard<std::mutex> lock(callbacks_mutex_); std::lock_guard<std::mutex> lock(callbacks_mutex_);
BOOST_FOREACH(SocketCallbackInfo s, callbacks_) { BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
if (!FD_ISSET(s.socket_, &sockets)) { if (!FD_ISSET(s.socket_, &sockets)) {
continue; continue;
} }
found = true;
// something received over external socket // something received over external socket
if (s.callback_) { if (s.callback_) {
...@@ -1493,7 +1504,8 @@ IfaceMgr::receive6Indirect(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */ ...@@ -1493,7 +1504,8 @@ IfaceMgr::receive6Indirect(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
// layer access without integrating any specific features // layer access without integrating any specific features
// in IfaceMgr // in IfaceMgr
ex_sock.callback_(ex_sock.socket_); ex_sock.callback_(ex_sock.socket_);
}
if (found) {
return (Pkt6Ptr()); return (Pkt6Ptr());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment