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;
{
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();
-}
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;
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;
{
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();
-}
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;