libei: if we get disconnected after ei_device_add(), queue a removed event

If we get disconnected after calling ei_device_add() but before EIS saw and
processed the event, we need to emulate a removed event ourselves.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-19 10:41:58 +10:00
parent a41a025b65
commit 451875e287

View file

@ -302,6 +302,9 @@ ei_remove_device(struct ei_device *device)
struct ei *ei = ei_device_get_context(device);
int rc = connection_send_remove(ei, device);
if (ei->state == EI_STATE_DISCONNECTING)
ei_queue_removed_event(device);
list_remove(&device->link);
ei_device_unref(device);