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.
This commit is contained in:
Peter Hutterer 2023-03-02 14:34:49 +10:00
parent 3c589f1b20
commit 5f9bfe7b7b

View file

@ -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);