From 71f571dc65a90e9299806fae2c9511b85c9d71d8 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Tue, 9 Feb 2010 20:44:34 -0300 Subject: [PATCH] obexd: the session is shutdown when the agent exits the bus --- obexd/client/session.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/obexd/client/session.c b/obexd/client/session.c index ed0b94b7a..9948a4a37 100644 --- a/obexd/client/session.c +++ b/obexd/client/session.c @@ -588,21 +588,6 @@ static void abort_transfer(struct session_data *session) session_unref(session); } -int session_set_agent(struct session_data *session, const char *name, - const char *path) -{ - if (session == NULL) - return -EINVAL; - - if (session->agent_name != NULL || session->agent_path != NULL) - return -EALREADY; - - session->agent_name = g_strdup(name); - session->agent_path = g_strdup(path); - - return 0; -} - static void append_entry(DBusMessageIter *dict, const char *key, int type, void *val) { @@ -1865,3 +1850,24 @@ int session_put(struct session_data *session, char *buf, const char *targetname) return 0; } + +int session_set_agent(struct session_data *session, const char *name, + const char *path) +{ + if (session == NULL) + return -EINVAL; + + if (session->agent_name != NULL || session->agent_path != NULL) + return -EALREADY; + + session->agent_name = g_strdup(name); + session->agent_path = g_strdup(path); + + session->owner_watch = g_dbus_add_disconnect_watch(session->conn, + session->owner, owner_disconnected, + session, NULL); + + session_ref(session); + + return 0; +} -- 2.47.3