summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2020-03-18 20:13:20 -0400
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2020-03-19 19:38:51 +0000
commit80018c33157cb7d6f9ade4e4927fb6904f274658 (patch)
treefb1f36af64ec34f325725d826456afda7e85647c
parent92e891121e2bcebf94156e18c810bfb66c7dc0b2 (diff)
downloadgupnp-igd-80018c33157cb7d6f9ade4e4927fb6904f274658.tar.gz
Use non-deprecated GAsync style apis to RemovePortMapping call
-rw-r--r--libgupnp-igd/gupnp-simple-igd.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/libgupnp-igd/gupnp-simple-igd.c b/libgupnp-igd/gupnp-simple-igd.c
index 4206607..f7eed73 100644
--- a/libgupnp-igd/gupnp-simple-igd.c
+++ b/libgupnp-igd/gupnp-simple-igd.c
@@ -365,22 +365,26 @@ _external_ip_address_changed (GUPnPServiceProxy *proxy, const gchar *variable,
}
static void
-_service_proxy_delete_port_mapping (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
+_service_proxy_delete_port_mapping (GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
+ GUPnPServiceProxy *proxy = GUPNP_SERVICE_PROXY (source_object);
+ GUPnPServiceProxyAction *action;
GError *error = NULL;
GUPnPSimpleIgd *self = user_data;
+ action = gupnp_service_proxy_call_action_finish (proxy, res, &error);
- if (!gupnp_service_proxy_end_action (proxy, action, &error,
- NULL))
- {
+ if (action == NULL ||
+ !gupnp_service_proxy_action_get_result (action, &error, NULL)) {
g_return_if_fail (error);
g_warning ("Error deleting port mapping: %s", error->message);
}
g_clear_error (&error);
+ if (action)
+ gupnp_service_proxy_action_unref (action);
+
if (self)
{
self->priv->deleting_count--;
@@ -395,15 +399,19 @@ free_proxymapping (struct ProxyMapping *pm, GUPnPSimpleIgd *self)
if (pm->mapped && self)
{
+ GUPnPServiceProxyAction *action;
+
self->priv->deleting_count++;
g_object_ref (self);
- gupnp_service_proxy_begin_action (pm->proxy->proxy,
- "DeletePortMapping",
- _service_proxy_delete_port_mapping, self,
+
+ action = gupnp_service_proxy_action_new ("DeletePortMapping",
"NewRemoteHost", G_TYPE_STRING, "",
"NewExternalPort", G_TYPE_UINT, pm->actual_external_port,
"NewProtocol", G_TYPE_STRING, pm->mapping->protocol,
NULL);
+
+ gupnp_service_proxy_call_action_async (pm->proxy->proxy, action, NULL,
+ _service_proxy_delete_port_mapping, self);
}
g_slice_free (struct ProxyMapping, pm);