summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/devices/bluetooth/nm-bluez5-dun.c44
-rw-r--r--src/core/devices/nm-acd-manager.c8
-rw-r--r--src/core/devices/wifi/nm-device-wifi.c7
-rw-r--r--src/core/dhcp/nm-dhcp-nettools.c4
-rw-r--r--src/core/dns/nm-dns-systemd-resolved.c19
-rw-r--r--src/core/ndisc/nm-lndp-ndisc.c4
-rw-r--r--src/core/nm-auth-utils.c8
-rw-r--r--src/core/nm-connectivity.c11
8 files changed, 25 insertions, 80 deletions
diff --git a/src/core/devices/bluetooth/nm-bluez5-dun.c b/src/core/devices/bluetooth/nm-bluez5-dun.c
index e29884d8b9..7efbfaf4c6 100644
--- a/src/core/devices/bluetooth/nm-bluez5-dun.c
+++ b/src/core/devices/bluetooth/nm-bluez5-dun.c
@@ -182,25 +182,18 @@ _connect_open_tty(NMBluez5DunContext *context)
nm_strerror_native(errsv),
errsv);
context->cdat->connect_open_tty_started_at = nm_utils_get_monotonic_timestamp_nsec();
- context->cdat->source = nm_g_timeout_source_new(100,
- G_PRIORITY_DEFAULT,
- _connect_open_tty_retry_cb,
- context,
- NULL);
- g_source_attach(context->cdat->source, NULL);
+ context->cdat->source =
+ nm_g_timeout_add_source(100, _connect_open_tty_retry_cb, context);
}
return -errsv;
}
context->rfcomm_tty_fd = fd;
- context->rfcomm_tty_poll_source = nm_g_unix_fd_source_new(context->rfcomm_tty_fd,
+ context->rfcomm_tty_poll_source = nm_g_unix_fd_add_source(context->rfcomm_tty_fd,
G_IO_ERR | G_IO_HUP,
- G_PRIORITY_DEFAULT,
_rfcomm_tty_poll_cb,
- context,
- NULL);
- g_source_attach(context->rfcomm_tty_poll_source, NULL);
+ context);
_context_invoke_callback_success(context);
return 0;
@@ -369,13 +362,10 @@ _connect_socket_connect(NMBluez5DunContext *context)
context->dst_str,
context->rfcomm_channel);
- context->cdat->source = nm_g_unix_fd_source_new(context->rfcomm_sock_fd,
+ context->cdat->source = nm_g_unix_fd_add_source(context->rfcomm_sock_fd,
G_IO_OUT,
- G_PRIORITY_DEFAULT,
_connect_socket_connect_cb,
- context,
- NULL);
- g_source_attach(context->cdat->source, NULL);
+ context);
return;
}
@@ -567,12 +557,8 @@ _connect_sdp_io_cb(int fd, GIOCondition condition, gpointer user_data)
nm_strerror_native(errsv),
errsv);
nm_clear_g_source_inst(&context->cdat->source);
- context->cdat->source = nm_g_timeout_source_new(1000,
- G_PRIORITY_DEFAULT,
- _connect_sdp_session_start_on_idle_cb,
- context,
- NULL);
- g_source_attach(context->cdat->source, NULL);
+ context->cdat->source =
+ nm_g_timeout_add_source(1000, _connect_sdp_session_start_on_idle_cb, context);
return G_SOURCE_REMOVE;
}
@@ -616,13 +602,10 @@ _connect_sdp_io_cb(int fd, GIOCondition condition, gpointer user_data)
}
/* Set callback responsible for update the internal SDP transaction */
- context->cdat->source = nm_g_unix_fd_source_new(fd,
+ context->cdat->source = nm_g_unix_fd_add_source(fd,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- G_PRIORITY_DEFAULT,
_connect_sdp_search_io_cb,
- context,
- NULL);
- g_source_attach(context->cdat->source, NULL);
+ context);
done:
if (error)
@@ -664,13 +647,10 @@ _connect_sdp_session_start(NMBluez5DunContext *context, GError **error)
return FALSE;
}
- context->cdat->source = nm_g_unix_fd_source_new(sdp_get_socket(context->cdat->sdp_session),
+ context->cdat->source = nm_g_unix_fd_add_source(sdp_get_socket(context->cdat->sdp_session),
G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- G_PRIORITY_DEFAULT,
_connect_sdp_io_cb,
- context,
- NULL);
- g_source_attach(context->cdat->source, NULL);
+ context);
return TRUE;
}
diff --git a/src/core/devices/nm-acd-manager.c b/src/core/devices/nm-acd-manager.c
index 995abacded..eb2da53a12 100644
--- a/src/core/devices/nm-acd-manager.c
+++ b/src/core/devices/nm-acd-manager.c
@@ -347,9 +347,7 @@ nm_acd_manager_start_probe(NMAcdManager *self, guint timeout)
nm_assert(!self->event_source);
n_acd_get_fd(self->acd, &fd);
- self->event_source =
- nm_g_unix_fd_source_new(fd, G_IO_IN, G_PRIORITY_DEFAULT, acd_event, self, NULL);
- g_source_attach(self->event_source, NULL);
+ self->event_source = nm_g_unix_fd_add_source(fd, G_IO_IN, acd_event, self);
return success ? 0 : -NME_UNSPEC;
}
@@ -434,9 +432,7 @@ nm_acd_manager_announce_addresses(NMAcdManager *self)
if (!self->event_source) {
n_acd_get_fd(self->acd, &fd);
- self->event_source =
- nm_g_unix_fd_source_new(fd, G_IO_IN, G_PRIORITY_DEFAULT, acd_event, self, NULL);
- g_source_attach(self->event_source, NULL);
+ self->event_source = nm_g_unix_fd_add_source(fd, G_IO_IN, acd_event, self);
}
return success ? 0 : -NME_UNSPEC;
diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c
index fca2fde515..c5b6dddecd 100644
--- a/src/core/devices/wifi/nm-device-wifi.c
+++ b/src/core/devices/wifi/nm-device-wifi.c
@@ -1673,12 +1673,7 @@ _scan_supplicant_request_scan_cb(NMSupplicantInterface *supp_iface,
* Artificially keep the scanning state on, for another SCAN_EXTRA_DELAY_MSEC msec. */
nm_clear_g_source_inst(&priv->scan_request_delay_source);
priv->scan_request_delay_source =
- nm_g_source_attach(nm_g_timeout_source_new(SCAN_EXTRA_DELAY_MSEC,
- G_PRIORITY_DEFAULT,
- _scan_request_delay_cb,
- self,
- NULL),
- NULL);
+ nm_g_timeout_add_source(SCAN_EXTRA_DELAY_MSEC, _scan_request_delay_cb, self);
g_clear_object(&priv->scan_request_cancellable);
_scan_notify_is_scanning(self);
diff --git a/src/core/dhcp/nm-dhcp-nettools.c b/src/core/dhcp/nm-dhcp-nettools.c
index f755eebca3..584d99e28a 100644
--- a/src/core/dhcp/nm-dhcp-nettools.c
+++ b/src/core/dhcp/nm-dhcp-nettools.c
@@ -969,9 +969,7 @@ nettools_create(NMDhcpNettools *self, GError **error)
n_dhcp4_client_get_fd(priv->client, &fd);
- priv->event_source =
- nm_g_unix_fd_source_new(fd, G_IO_IN, G_PRIORITY_DEFAULT, dhcp4_event_cb, self, NULL);
- g_source_attach(priv->event_source, NULL);
+ priv->event_source = nm_g_unix_fd_add_source(fd, G_IO_IN, dhcp4_event_cb, self);
return TRUE;
}
diff --git a/src/core/dns/nm-dns-systemd-resolved.c b/src/core/dns/nm-dns-systemd-resolved.c
index 4b8c4f9418..61d52771df 100644
--- a/src/core/dns/nm-dns-systemd-resolved.c
+++ b/src/core/dns/nm-dns-systemd-resolved.c
@@ -422,12 +422,7 @@ ensure_resolved_running(NMDnsSystemdResolved *self)
priv->try_start_blocked = TRUE;
priv->try_start_timeout_source =
- nm_g_source_attach(nm_g_timeout_source_new(4000,
- G_PRIORITY_DEFAULT,
- _ensure_resolved_running_timeout,
- self,
- NULL),
- NULL);
+ nm_g_timeout_add_source(4000, _ensure_resolved_running_timeout, self);
nm_dbus_connection_call_start_service_by_name(priv->dbus_connection,
SYSTEMD_RESOLVED_DBUS_SERVICE,
@@ -821,19 +816,13 @@ _resolve_start(NMDnsSystemdResolved *self, NMDnsSystemdResolvedResolveHandle *ha
_LOG2T(handle, "systemd-resolved not running. Failing on idle...");
nm_assert(!handle->timeout_source);
handle->is_failing_on_idle = TRUE;
- handle->timeout_source = nm_g_source_attach(
- nm_g_idle_source_new(G_PRIORITY_DEFAULT, _resolve_failing_on_idle, handle, NULL),
- NULL);
+ handle->timeout_source = nm_g_idle_add_source(_resolve_failing_on_idle, handle);
return;
}
if (!handle->timeout_source) {
- handle->timeout_source = nm_g_source_attach(nm_g_timeout_source_new(handle->timeout_msec,
- G_PRIORITY_DEFAULT,
- _resolve_handle_timeout,
- handle,
- NULL),
- NULL);
+ handle->timeout_source =
+ nm_g_timeout_add_source(handle->timeout_msec, _resolve_handle_timeout, handle);
}
if (is_running == NM_TERNARY_DEFAULT) {
diff --git a/src/core/ndisc/nm-lndp-ndisc.c b/src/core/ndisc/nm-lndp-ndisc.c
index f11178f824..996c877571 100644
--- a/src/core/ndisc/nm-lndp-ndisc.c
+++ b/src/core/ndisc/nm-lndp-ndisc.c
@@ -599,9 +599,7 @@ start(NMNDisc *ndisc)
fd = ndp_get_eventfd(priv->ndp);
- priv->event_source =
- nm_g_unix_fd_source_new(fd, G_IO_IN, G_PRIORITY_DEFAULT, event_ready, ndisc, NULL);
- g_source_attach(priv->event_source, NULL);
+ priv->event_source = nm_g_unix_fd_add_source(fd, G_IO_IN, event_ready, ndisc);
/* Flush any pending messages to avoid using obsolete information */
event_ready(fd, 0, ndisc);
diff --git a/src/core/nm-auth-utils.c b/src/core/nm-auth-utils.c
index 006264dd28..da17b1a4cc 100644
--- a/src/core/nm-auth-utils.c
+++ b/src/core/nm-auth-utils.c
@@ -124,12 +124,8 @@ _cancellable_idle_cb(gpointer user_data)
static void
_cancellable_on_idle(NMAuthChain *self)
{
- if (self->cancellable_idle_source)
- return;
-
- self->cancellable_idle_source =
- nm_g_idle_source_new(G_PRIORITY_DEFAULT, _cancellable_idle_cb, self, NULL);
- g_source_attach(self->cancellable_idle_source, NULL);
+ if (!self->cancellable_idle_source)
+ self->cancellable_idle_source = nm_g_idle_add_source(_cancellable_idle_cb, self);
}
GCancellable *
diff --git a/src/core/nm-connectivity.c b/src/core/nm-connectivity.c
index 220252e987..2c412341b7 100644
--- a/src/core/nm-connectivity.c
+++ b/src/core/nm-connectivity.c
@@ -508,15 +508,8 @@ multi_socket_cb(CURL *e_handle, curl_socket_t fd, int what, void *userdata, void
else
condition = 0;
- if (condition) {
- fdp->source = nm_g_unix_fd_source_new(fd,
- condition,
- G_PRIORITY_DEFAULT,
- _con_curl_socketevent_cb,
- fdp,
- NULL);
- g_source_attach(fdp->source, NULL);
- }
+ if (condition)
+ fdp->source = nm_g_unix_fd_add_source(fd, condition, _con_curl_socketevent_cb, fdp);
}
return CURLM_OK;