Browse Source

[3315] Changes after second review:

 - SocketCallbackContainer is now SocketCallbackInfoContainer
 - test callback is now quiet
Tomek Mrugalski 11 years ago
parent
commit
fba33a4f33
3 changed files with 8 additions and 9 deletions
  1. 6 6
      src/lib/dhcp/iface_mgr.cc
  2. 2 2
      src/lib/dhcp/iface_mgr.h
  3. 0 1
      src/lib/dhcp/tests/iface_mgr_unittest.cc

+ 6 - 6
src/lib/dhcp/iface_mgr.cc

@@ -228,7 +228,7 @@ IfaceMgr::isDirectResponseSupported() const {
 
 void
 IfaceMgr::addExternalSocket(int socketfd, SocketCallback callback) {
-    for (SocketCallbackContainer::iterator s = callbacks_.begin();
+    for (SocketCallbackInfoContainer::iterator s = callbacks_.begin();
          s != callbacks_.end(); ++s) {
 
         // There's such a socket description there already.
@@ -248,7 +248,7 @@ IfaceMgr::addExternalSocket(int socketfd, SocketCallback callback) {
 
 void
 IfaceMgr::deleteExternalSocket(int socketfd) {
-    for (SocketCallbackContainer::iterator s = callbacks_.begin();
+    for (SocketCallbackInfoContainer::iterator s = callbacks_.begin();
          s != callbacks_.end(); ++s) {
         if (s->socket_ == socketfd) {
             callbacks_.erase(s);
@@ -845,7 +845,7 @@ IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
 
     // if there are any callbacks for external sockets registered...
     if (!callbacks_.empty()) {
-        for (SocketCallbackContainer::const_iterator s = callbacks_.begin();
+        for (SocketCallbackInfoContainer::const_iterator s = callbacks_.begin();
              s != callbacks_.end(); ++s) {
             FD_SET(s->socket_, &sockets);
             if (maxfd < s->socket_) {
@@ -868,7 +868,7 @@ IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
     }
 
     // Let's find out which socket has the data
-    for (SocketCallbackContainer::iterator s = callbacks_.begin();
+    for (SocketCallbackInfoContainer::iterator s = callbacks_.begin();
          s != callbacks_.end(); ++s) {
         if (!FD_ISSET(s->socket_, &sockets)) {
             continue;
@@ -946,7 +946,7 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
 
     // if there are any callbacks for external sockets registered...
     if (!callbacks_.empty()) {
-        for (SocketCallbackContainer::const_iterator s = callbacks_.begin();
+        for (SocketCallbackInfoContainer::const_iterator s = callbacks_.begin();
              s != callbacks_.end(); ++s) {
 
             // Add it to the set as well
@@ -971,7 +971,7 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
     }
 
     // Let's find out which socket has the data
-    for (SocketCallbackContainer::iterator s = callbacks_.begin();
+    for (SocketCallbackInfoContainer::iterator s = callbacks_.begin();
          s != callbacks_.end(); ++s) {
         if (!FD_ISSET(s->socket_, &sockets)) {
             continue;

+ 2 - 2
src/lib/dhcp/iface_mgr.h

@@ -407,7 +407,7 @@ public:
     };
 
     /// Defines storage container for callbacks for external sockets
-    typedef std::list<SocketCallbackInfo> SocketCallbackContainer;
+    typedef std::list<SocketCallbackInfo> SocketCallbackInfoContainer;
 
     /// @brief Packet reception buffer size
     ///
@@ -1047,7 +1047,7 @@ private:
     PktFilter6Ptr packet_filter6_;
 
     /// @brief Contains list of callbacks for external sockets
-    SocketCallbackContainer callbacks_;
+    SocketCallbackInfoContainer callbacks_;
 };
 
 }; // namespace isc::dhcp

+ 0 - 1
src/lib/dhcp/tests/iface_mgr_unittest.cc

@@ -2593,7 +2593,6 @@ volatile bool callback_ok;
 volatile bool callback2_ok;
 
 void my_callback(void) {
-    cout << "Callback triggered." << endl;
     callback_ok = true;
 }