From 7d9df9ef74b8f206f62ff260510f01fcb99208a1 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Tue, 31 Jan 2012 10:40:53 +1100 Subject: [PATCH] IPC: better handle a disconnect been called from within connection_created() Signed-off-by: Angus Salkeld --- lib/ipc_us.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ipc_us.c b/lib/ipc_us.c index 8c989aa..4251f25 100644 --- a/lib/ipc_us.c +++ b/lib/ipc_us.c @@ -612,10 +612,14 @@ send_response: } if (res == 0) { + qb_ipcs_connection_ref(c); if (s->serv_fns.connection_created) { s->serv_fns.connection_created(c); } - c->state = QB_IPCS_CONNECTION_ESTABLISHED; + if (c->state == QB_IPCS_CONNECTION_ACTIVE) { + c->state = QB_IPCS_CONNECTION_ESTABLISHED; + } + qb_ipcs_connection_unref(c); } else { if (res == -EACCES) { qb_util_log(LOG_ERR, "Invalid IPC credentials.");