Parcourir la source

[1957] Corrected spaces between operators and a few comments.

Stephen Morris il y a 13 ans
Parent
commit
61667bcc9c
2 fichiers modifiés avec 25 ajouts et 27 suppressions
  1. 15 17
      src/lib/dhcp/iface_mgr.cc
  2. 10 10
      src/lib/dhcp/iface_mgr.h

+ 15 - 17
src/lib/dhcp/iface_mgr.cc

@@ -198,7 +198,7 @@ void IfaceMgr::stubDetectIfaces() {
         iface.flag_up_ = true;
         iface.flag_running_ = true;
 
-        // note that we claim that this is not a loopback. iface_mgr tries to open a
+        // Note that we claim that this is not a loopback. iface_mgr tries to open a
         // socket on all interaces that are up, running and not loopback. As this is
         // the only interface we were able to detect, let's pretend this is a normal
         // interface.
@@ -229,8 +229,8 @@ bool IfaceMgr::openSockets4(const uint16_t port) {
     int sock;
     int count = 0;
 
-    for (IfaceCollection::iterator iface=ifaces_.begin();
-         iface!=ifaces_.end();
+    for (IfaceCollection::iterator iface = ifaces_.begin();
+         iface != ifaces_.end();
          ++iface) {
 
         cout << "Trying interface " << iface->getFullName() << endl;
@@ -242,18 +242,17 @@ bool IfaceMgr::openSockets4(const uint16_t port) {
         }
 
         AddressCollection addrs = iface->getAddresses();
-
-        for (AddressCollection::iterator addr= addrs.begin();
+        for (AddressCollection::iterator addr = addrs.begin();
              addr != addrs.end();
              ++addr) {
 
-            // skip IPv6 addresses
+            // Skip IPv6 addresses
             if (addr->getFamily() != AF_INET) {
                 continue;
             }
 
             sock = openSocket(iface->getName(), *addr, port);
-            if (sock<0) {
+            if (sock < 0) {
                 cout << "Failed to open unicast socket." << endl;
                 return (false);
             }
@@ -269,8 +268,8 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
     int sock;
     int count = 0;
 
-    for (IfaceCollection::iterator iface=ifaces_.begin();
-         iface!=ifaces_.end();
+    for (IfaceCollection::iterator iface = ifaces_.begin();
+         iface != ifaces_.end();
          ++iface) {
 
         if (iface->flag_loopback_ ||
@@ -280,7 +279,6 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
         }
 
         AddressCollection addrs = iface->getAddresses();
-
         for (AddressCollection::iterator addr = addrs.begin();
              addr != addrs.end();
              ++addr) {
@@ -291,7 +289,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
             }
 
             sock = openSocket(iface->getName(), *addr, port);
-            if (sock<0) {
+            if (sock < 0) {
                 cout << "Failed to open unicast socket." << endl;
                 return (false);
             }
@@ -300,7 +298,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
             // works well on Mac OS (and possibly other BSDs), but does not work
             // on Linux.
             if ( !joinMulticast(sock, iface->getName(),
-                                string(ALL_DHCP_RELAY_AGENTS_AND_SERVERS) ) ) {
+                                string(ALL_DHCP_RELAY_AGENTS_AND_SERVERS))) {
                 close(sock);
                 isc_throw(Unexpected, "Failed to join " << ALL_DHCP_RELAY_AGENTS_AND_SERVERS
                           << " multicast group.");
@@ -316,7 +314,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
             int sock2 = openSocket(iface->getName(),
                                    IOAddress(ALL_DHCP_RELAY_AGENTS_AND_SERVERS),
                                    port);
-            if (sock2<0) {
+            if (sock2 < 0) {
                 isc_throw(Unexpected, "Failed to open multicast socket on "
                           << " interface " << iface->getFullName());
                 iface->delSocket(sock); // delete previously opened socket
@@ -401,8 +399,8 @@ int IfaceMgr::openSocketFromIface(const std::string& ifname,
                                   const uint8_t family) {
     int sock = 0;
     // Search for specified interface among detected interfaces.
-    for (IfaceCollection::iterator iface=ifaces_.begin();
-         iface!=ifaces_.end();
+    for (IfaceCollection::iterator iface = ifaces_.begin();
+         iface != ifaces_.end();
          ++iface) {
 
         if ((iface->getFullName() != ifname) &&
@@ -437,8 +435,8 @@ int IfaceMgr::openSocketFromAddress(const IOAddress& addr,
     int sock = 0;
     // Search through detected interfaces and addresses to match
     // local address we got.
-    for (IfaceCollection::iterator iface=ifaces_.begin();
-         iface!=ifaces_.end();
+    for (IfaceCollection::iterator iface = ifaces_.begin();
+         iface != ifaces_.end();
          ++iface) {
 
         AddressCollection addrs = iface->getAddresses();

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

@@ -378,10 +378,10 @@ public:
 
     /// @brief Opens UDP/IP socket and binds it to interface specified.
     ///
-    /// This method differs from \ref openSocket such that it allows
-    /// not to specify local address to which socket will be bound.
-    /// Instead, method searches through addresses on specified
-    /// interface and selects one that matches address family.
+    /// This method differs from \ref openSocket in that it does not require
+    /// the specification of a local address to which socket will be bound.
+    /// Instead, the method searches through the addresses on the specified
+    /// interface and selects one that matches the address family.
     ///
     /// @param ifname name of the interface
     /// @param port UDP port
@@ -395,8 +395,8 @@ public:
 
     /// @brief Opens UDP/IP socket and binds to address specified
     ///
-    /// This methods differs from \ref openSocket such that it allows
-    /// not to specify interface to which socket will be bound.
+    /// This methods differs from \ref openSocket in that it does not require
+    /// the specification of the interface to which the socket will be bound.
     ///
     /// @param addr address to be bound
     /// @param port UDP port
@@ -408,10 +408,10 @@ public:
 
     /// @brief Opens UDP/IP socket to be used to connect to remote address
     ///
-    /// This method identifies local address to be used to connect
-    /// to remote address specified as argument.
-    /// Once local address is idetified \ref openSocket is called
-    /// to open socket and bind it to interface, address and port.
+    /// This method identifies the local address to be used to connect to the
+    /// remote address specified as argument.  Once the local address is
+    /// identified, \ref openSocket is called to open a socket and bind it to
+    /// the interface, address and port.
     ///
     /// @param remote_addr remote address to connect to
     /// @param port UDP port