shill: create Sockets object in RTNLHandler
Create and maintain Sockets object in RTNLHandler to prevent the
possibility of Sockets object being destructed before RTNLHandler.
BUG=chromium:448823
TEST=USE="asan clang" FEATURES=test emerge-$BOARD shill apmanager
Verify we still have network connectivity through shill
Verify apmanager doesn't seg fault when exiting
Change-Id: I3a60068718ba6c547cef1437aa1fec22bd27e3eb
Reviewed-on: https://chromium-review.googlesource.com/240801
Trybot-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
diff --git a/device_info.cc b/device_info.cc
index ddf162f..31f995f 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -17,7 +17,6 @@
#include <shill/net/rtnl_handler.h>
#include <shill/net/rtnl_listener.h>
#include <shill/net/rtnl_message.h>
-#include <shill/net/sockets.h>
#include "apmanager/manager.h"
@@ -43,8 +42,7 @@
device_info_root_(kDeviceInfoRoot),
manager_(manager),
netlink_manager_(NetlinkManager::GetInstance()),
- rtnl_handler_(RTNLHandler::GetInstance()),
- sockets_(new shill::Sockets()) {
+ rtnl_handler_(RTNLHandler::GetInstance()) {
}
DeviceInfo::~DeviceInfo() {}
@@ -65,7 +63,7 @@
EnumerateDevices();
// Start RTNL for monitoring network interfaces.
- rtnl_handler_->Start(sockets_.get());
+ rtnl_handler_->Start();
link_listener_.reset(
new RTNLListener(RTNLHandler::kRequestLink, link_callback_));
// Request link infos.
diff --git a/device_info.h b/device_info.h
index 2a8588d..afd6521 100644
--- a/device_info.h
+++ b/device_info.h
@@ -23,7 +23,6 @@
class RTNLHandler;
class RTNLMessage;
class RTNLListener;
-class Sockets;
} // namespace shill
@@ -99,8 +98,6 @@
shill::NetlinkManager* netlink_manager_;
shill::RTNLHandler* rtnl_handler_;
- std::unique_ptr<shill::Sockets> sockets_;
-
DISALLOW_COPY_AND_ASSIGN(DeviceInfo);
};