From 5f9bfe7b7bfcf9905cf3c08170e27dedf04ddf5d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 2 Mar 2023 14:34:49 +1000 Subject: [PATCH] client: drop seats when destroying the client This *should* have happened when the client got disconnected but in some race conditions a seat may be added after the client gets disconnected. Reproducible (sometimes) by test_invalid_object_id with the eis-demo-server: - client connects, sends invalid object ID, gets disconnected - server sees CONNECTED, adds a seat, then sees DISCONNECTED and drops the client. From the demo-server's POV the seat is handled by the client, so it expects the client to destroy it. --- src/libeis-client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libeis-client.c b/src/libeis-client.c index d088d7d..9a22f00 100644 --- a/src/libeis-client.c +++ b/src/libeis-client.c @@ -47,9 +47,13 @@ DEFINE_TRISTATE(started, finished, connected); DEFINE_UNREF_CLEANUP_FUNC(brei_result); +static void +client_drop_seats(struct eis_client *client); + static void eis_client_destroy(struct eis_client *client) { + client_drop_seats(client); eis_handshake_unref(client->setup); eis_connection_unref(client->connection); free(client->name);