diff options
author | Luiz Augusto von Dentz <luiz.dentz@indt.org.br> | 2008-09-04 16:30:35 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@indt.org.br> | 2008-09-04 16:31:31 -0300 |
commit | a3634219a1f00b7386c55f34d6707690ff73b605 (patch) | |
tree | 2972fbda087183cf47cec7b82138d10b6d590a8a | |
parent | f8679ba6789c4d1e508ba9647d4b4847e4ea1f0e (diff) |
Add proper debug output per session reference.
-rw-r--r-- | src/adapter.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/adapter.c b/src/adapter.c index 2cbd839d..7fa5adf0 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -635,10 +635,21 @@ static void session_free(struct session_req *req) g_free(req); } +static struct session_req *session_ref(struct session_req *req) +{ + req->refcount++; + + debug("session_ref(%p): ref=%d", req, req->refcount); + + return req; +} + static void session_unref(struct session_req *req) { req->refcount--; + debug("session_unref(%p): ref=%d", req, req->refcount); + if (req->refcount) return; @@ -660,7 +671,6 @@ static struct session_req *create_session(struct btd_adapter *adapter, req->conn = dbus_connection_ref(conn); req->msg = dbus_message_ref(msg); req->mode = mode; - req->refcount = 1; if (cb) req->id = g_dbus_add_disconnect_watch(conn, @@ -670,7 +680,7 @@ static struct session_req *create_session(struct btd_adapter *adapter, info("%s session %p with %s activated", req->mode ? "Mode" : "Discovery", req, sender); - return req; + return session_ref(req); } static void confirm_mode_cb(struct agent *agent, DBusError *err, void *data) @@ -1431,7 +1441,7 @@ static DBusMessage *adapter_start_discovery(DBusConnection *conn, req = find_session(adapter->disc_sessions, msg); if (req) { - req->refcount++; + session_ref(req); return dbus_message_new_method_return(msg); } |