reserve: Fix leaking NameLost signals after release+acquire
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Wed, 30 Jan 2013 08:30:31 +0000 (09:30 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Thu, 31 Jan 2013 12:04:45 +0000 (14:04 +0200)
commit58def1fd1de0de7d5732519539503a7ad83f24a2
tree56604ca0b15c02a41ec357f4a4e55ec5bb116a4c
parentcb0f3d287857d5385f4a879f8ab565d71bc8f068
reserve: Fix leaking NameLost signals after release+acquire

The use of the pseudo-blocking D-Bus calls leads to the problem that
NameLost signals are received after the reply to ReleaseName().

The problem with this is that a later acquisition of the same audio
device can potentially receive the NameLost signal corresponding to
the previous instance, due to the fact that the signal hasn't been
popped from the D-Bus message queue.

The simplest approach to solve this problem is to poll the actual name
owner from the D-Bus daemon, in order to make sure that we did really
lose the name.

The proposal uses a blocking call to GetNameOwner to avoid incosistent
states in the internal APIs: it would otherwise be possible to have a
"busy" device before the reservation has been lost, in the unlikely
case if some other process acquires the name before we got the
confirmation that the NameLost was actually true.
src/modules/reserve.c