Removed select_source_network_interface() function, replace by simple call to Network...
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sat, 20 Aug 2011 15:26:23 +0000 (12:26 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sat, 20 Aug 2011 15:26:23 +0000 (12:26 -0300)
src/icmp/icmppinger.cpp
src/icmp/icmppinger.h
src/tcp/tcppinger.cpp
src/tcp/tcppinger.h

index c96416a..fcfc161 100644 (file)
@@ -63,8 +63,7 @@ IcmpPinger::IcmpPinger(
     PingerStatus( PingStatus_NotSent ),
     PingDoneCallback()
 {
-    if ( !source_network_interface.empty() &&
-         !select_source_network_interface( source_network_interface ) )
+    if ( !NetInterface.bind() )
     {
         GlobalLogger.error() << "Error: could not bind the socket "
             << "with the local interface. " << ::strerror( errno )  << endl;
@@ -358,21 +357,3 @@ void IcmpPinger::set_ping_status( PingStatus ping_status )
 {
     PingerStatus = ping_status;
 }
-
-/**
- * Avoid the socket to drop to another network interface if the destination
- * is unreachable through the binded interface. Packets are sent only from
- * this interface.
- *
- * @param source_network_interface The network interface to bind the pinger.
- *
- * @return false if the bind failed.
- */
-bool IcmpPinger::select_source_network_interface(
-        const string &source_network_interface
-)
-{
-    BOOST_ASSERT( !source_network_interface.empty() );
-
-    return NetInterface.bind();
-}
index 1cbc339..69a92e4 100644 (file)
@@ -63,10 +63,6 @@ private:
 
     void set_ping_status( PingStatus ping_status );
 
-    bool select_source_network_interface(
-            const std::string &source_network_interface
-    );
-
 private:
     /// The IO service object, which has the loop event
     boost::asio::io_service &IoService;
index 3b91cdd..fe4eee5 100644 (file)
@@ -71,8 +71,7 @@ TcpPinger::TcpPinger(
     PingerStatus( PingStatus_NotSent ),
     PingDoneCallback()
 {
-    if ( !source_network_interface_name.empty() &&
-         !select_source_network_interface( source_network_interface_name ) )
+    if ( !NetInterface.bind() )
     {
         GlobalLogger.error() << "Error: could not bind the socket "
                 "with the local interface. " << ::strerror( errno )  << endl;
@@ -331,21 +330,3 @@ void TcpPinger::set_ping_status( PingStatus ping_status )
 {
     PingerStatus = ping_status;
 }
-
-/**
- * Avoid the socket to drop to another network interface if the destination
- * is unreachable through the binded interface. Packets are sent only from
- * this interface.
- *
- * @param source_network_interface_name The network interface to bind the pinger.
- *
- * @return false if the bind failed.
- */
-bool TcpPinger::select_source_network_interface(
-        const string &source_network_interface_name
-)
-{
-    BOOST_ASSERT( !source_network_interface_name.empty() );
-
-    return NetInterface.bind();
-}
index 68d64ac..51382ba 100644 (file)
@@ -80,10 +80,6 @@ private:
 
     void set_ping_status( PingStatus ping_status );
 
-    bool select_source_network_interface(
-            const std::string &source_network_interface_name
-    );
-
 private:
     /// io service object, which has the loop event
     boost::asio::io_service &IoService;