aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-02-26 14:32:44 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-02-26 14:32:44 +0100
commitafff776f7e27c8be7610cfbd23c4d1be32699ed9 (patch)
tree319c846688f3d2d0e7361deb1be332a88f68d547
parent9e8fda2954d951ea819dbddfe5afe466b2306074 (diff)
afb-stub-ws: cosmetic improvements
Change-Id: Ib6adf0ca4bdfee9d3da07055430bfe1974ac28bc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-stub-ws.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/afb-stub-ws.c b/src/afb-stub-ws.c
index 37607ee0..136bb358 100644
--- a/src/afb-stub-ws.c
+++ b/src/afb-stub-ws.c
@@ -498,14 +498,17 @@ static void record_session(struct afb_stub_ws *stubws, struct afb_session *sessi
}
}
-static void release_sessions(struct afb_stub_ws *stubws)
+static void release_all_sessions(struct afb_stub_ws *stubws)
{
- struct server_session *s;
+ struct server_session *s, *n;
- while((s = stubws->sessions)) {
- stubws->sessions = s->next;
+ s = stubws->sessions;
+ stubws->sessions = NULL;
+ while(s) {
+ n = s->next;
afb_session_unref(s->session);
free(s);
+ s = n;
}
}
@@ -654,7 +657,7 @@ static void on_hangup(void *closure)
if (stubws->on_hangup)
stubws->on_hangup(stubws);
- release_sessions(stubws);
+ release_all_sessions(stubws);
afb_stub_ws_unref(stubws);
}
@@ -712,7 +715,7 @@ void afb_stub_ws_unref(struct afb_stub_ws *stubws)
drop_all_events(stubws);
if (stubws->listener)
afb_evt_listener_unref(stubws->listener);
- release_sessions(stubws);
+ release_all_sessions(stubws);
afb_proto_ws_unref(stubws->proto);
afb_cred_unref(stubws->cred);
afb_apiset_unref(stubws->apiset);