Skip to content

m-reserve-device: replace the hash table key on new insert

Peter Hutterer requested to merge whot/wireplumber:wip/reserve-fix into master

We're using the WpReserveDevice's name as key in the hash table, so we must update the key as well when we replace an item in the hashtable - the old device (and its name) will be released.

The side-effect of this is that the third device with an identical name will no longer replace the previous device. This results in the following sequence:

  • dev1 added: name Audio0
    • dev1 requests name owner Audio0
  • dev2 added: name Audio0
    • replace dev1 in the hashtable
      • dev1 emits "release" signal
      • dev1 unowns the Audio0 name
    • dev2 requests name owner Audio0
  • dev3 added: name Audio0
    • adds to the hashtable because the existing key is now undefined
    • dev3 requests name owner Audio0
      • error, you cannot request ownership for the same name twice

Fixes #93 (closed)

Merge request reports

Loading