return ifindex_;
}
-prefix_ senf::NetdeviceController::~NetdeviceController()
-{
- close( sockfd_->fd);
-}
-
prefix_ void senf::NetdeviceController::ifrName(ifreq& ifr)
const
{
{
if ( fd < 0)
SENF_THROW_SYSTEM_EXCEPTION("Could not open socket for NetdeviceController.");
+ std::cerr << ">>Made SockFd: " << fd << std::endl;
}
prefix_ senf::NetdeviceController::SockFd::~SockFd()
{
+ std::cerr << ">>Dispose SockFd: " << fd << std::endl;
::close(fd);
}
prefix_ senf::NetdeviceController::SockFd::ptr senf::NetdeviceController::sockfd()
{
static boost::weak_ptr<SockFd> sockfd;
-
- if (sockfd.expired()) {
- SockFd::ptr newsockfd (new SockFd());
- sockfd = newsockfd;
- return newsockfd;
- }
- return sockfd.lock();
-
+ SockFd::ptr p (sockfd.lock());
+ if (!p)
+ sockfd = p = SockFd::ptr(new SockFd());
+ return p;
}
///////////////////////////////cc.e////////////////////////////////////////
///< Construct a new controller for the given interface name.
explicit NetdeviceController(int interface_index);
///< Construct a new controller for the given interface index.
- virtual ~NetdeviceController();
-
int interfaceIndex() const; ///< return the interface index
MACAddress hardwareAddress() const;
///< return hardware address