libwebserv: Remove unused Disconnect() method.
DBusServer::Disconnect() method was not used anywhere. Instead, the
unique_ptr<Server> can be just destroyed to make it disconnect from
DBus. Note that this matches the connection side, since it is only
connected during construction (via factory in the Server class).
The order of the private data members was changed to match the
destruction order used in the Disconnect() method.
Bug: None
TEST=FEATURES=test emerge-stom webserver
Change-Id: I2552a40bd87c54bf35f22718e9d0230011e7e4f6
diff --git a/libwebserv/dbus_server.cc b/libwebserv/dbus_server.cc
index d7f4c85..21ae1b1 100644
--- a/libwebserv/dbus_server.cc
+++ b/libwebserv/dbus_server.cc
@@ -132,18 +132,6 @@
base::Bind(&DBusServer::ProtocolHandlerRemoved, base::Unretained(this)));
}
-void DBusServer::Disconnect() {
- on_server_offline_.Reset();
- on_server_online_.Reset();
- protocol_handlers_ids_.clear();
- protocol_handlers_names_.clear();
- // Release D-Bus object manager proxy after all the dependent maps are freed
- // (e.g. |protocol_handlers_names_| contains pointers to ProtocolHandlerProxy,
- // instances of which are owned by the D-Bus object manager).
- object_manager_.reset();
- dbus_object_.reset();
-}
-
void DBusServer::Online(
org::chromium::WebServer::ServerProxyInterface* server) {
VLOG(1) << "Web server is on-line.";
diff --git a/libwebserv/dbus_server.h b/libwebserv/dbus_server.h
index dbfdbe2..c49f558 100644
--- a/libwebserv/dbus_server.h
+++ b/libwebserv/dbus_server.h
@@ -84,8 +84,6 @@
friend class DBusProtocolHandler;
class RequestHandler;
- void Disconnect();
-
// Handler invoked when a connection is established to web server daemon.
void Online(org::chromium::WebServer::ServerProxyInterface* server);
@@ -111,11 +109,17 @@
// Private implementation of D-Bus RequestHandlerInterface called by the web
// server daemon whenever a new request is available to be processed.
std::unique_ptr<RequestHandler> request_handler_;
+
+ // D-Bus object to handler registration of RequestHandlerInterface.
+ std::unique_ptr<brillo::dbus_utils::DBusObject> dbus_object_;
+
// D-Bus object adaptor for RequestHandlerInterface.
std::unique_ptr<org::chromium::WebServer::RequestHandlerAdaptor>
dbus_adaptor_;
- // D-Bus object to handler registration of RequestHandlerInterface.
- std::unique_ptr<brillo::dbus_utils::DBusObject> dbus_object_;
+
+ // D-Bus object manager proxy that receives notification of web server
+ // daemon's D-Bus object creation and destruction.
+ std::unique_ptr<org::chromium::WebServer::ObjectManagerProxy> object_manager_;
// A mapping of protocol handler name to the associated object.
std::map<std::string, std::unique_ptr<DBusProtocolHandler>>
@@ -132,10 +136,6 @@
base::Callback<void(ProtocolHandler*)> on_protocol_handler_connected_;
base::Callback<void(ProtocolHandler*)> on_protocol_handler_disconnected_;
- // D-Bus object manager proxy that receives notification of web server
- // daemon's D-Bus object creation and destruction.
- std::unique_ptr<org::chromium::WebServer::ObjectManagerProxy> object_manager_;
-
// D-Bus proxy for the web server main object.
org::chromium::WebServer::ServerProxyInterface* proxy_{nullptr};