dns: don't let the plugins assert the bus manager has a connection
Make them just ask for connections from GDBus, as other D-Bus clients do. GDBus anyway reuses the connection if it has one, but allows us to deal with errors in a more civilized manner.
This commit is contained in:
@@ -306,8 +306,6 @@ start_dnsmasq (NMDnsDnsmasq *self)
|
|||||||
const char *argv[15];
|
const char *argv[15];
|
||||||
GPid pid = 0;
|
GPid pid = 0;
|
||||||
guint idx = 0;
|
guint idx = 0;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
GDBusConnection *connection;
|
|
||||||
|
|
||||||
if (priv->running) {
|
if (priv->running) {
|
||||||
/* the dnsmasq process is running. Nothing to do. */
|
/* the dnsmasq process is running. Nothing to do. */
|
||||||
@@ -358,14 +356,8 @@ start_dnsmasq (NMDnsDnsmasq *self)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
g_return_if_fail (dbus_mgr);
|
|
||||||
|
|
||||||
connection = nm_dbus_manager_get_connection (dbus_mgr);
|
|
||||||
g_return_if_fail (connection);
|
|
||||||
|
|
||||||
priv->dnsmasq_cancellable = g_cancellable_new ();
|
priv->dnsmasq_cancellable = g_cancellable_new ();
|
||||||
g_dbus_proxy_new (connection,
|
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
|
||||||
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
|
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
|
||||||
NULL,
|
NULL,
|
||||||
DNSMASQ_DBUS_SERVICE,
|
DNSMASQ_DBUS_SERVICE,
|
||||||
|
@@ -391,19 +391,11 @@ static void
|
|||||||
nm_dns_systemd_resolved_init (NMDnsSystemdResolved *self)
|
nm_dns_systemd_resolved_init (NMDnsSystemdResolved *self)
|
||||||
{
|
{
|
||||||
NMDnsSystemdResolvedPrivate *priv = NM_DNS_SYSTEMD_RESOLVED_GET_PRIVATE (self);
|
NMDnsSystemdResolvedPrivate *priv = NM_DNS_SYSTEMD_RESOLVED_GET_PRIVATE (self);
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
GDBusConnection *connection;
|
|
||||||
|
|
||||||
c_list_init (&priv->request_queue_lst_head);
|
c_list_init (&priv->request_queue_lst_head);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
g_return_if_fail (dbus_mgr);
|
|
||||||
|
|
||||||
connection = nm_dbus_manager_get_connection (dbus_mgr);
|
|
||||||
g_return_if_fail (connection);
|
|
||||||
|
|
||||||
priv->init_cancellable = g_cancellable_new ();
|
priv->init_cancellable = g_cancellable_new ();
|
||||||
g_dbus_proxy_new (connection,
|
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
|
||||||
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
|
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
|
||||||
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
|
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
|
||||||
NULL,
|
NULL,
|
||||||
|
Reference in New Issue
Block a user