@@ -201,28 +201,31 @@ function SonosPersistentSsdpTask:get_player_info(reply_tx, ...)
201201 local household_id_or_mac = select (1 , ... )
202202 local player_id = select (2 , ... )
203203
204- local lookup_table , lookup_key , bad_key_part
204+ local wait_table_key , lookup_table , lookup_key , bad_key_part
205205
206206 if player_id ~= nil and type (player_id ) == " string" then
207+ wait_table_key = " waiting_for_unique_key"
207208 lookup_table = self .player_info_by_sonos_ids
208209 lookup_key , bad_key_part = utils .sonos_unique_key (household_id_or_mac , player_id )
209210 else
211+ wait_table_key = " waiting_for_mac_addr"
210212 lookup_table = self .player_info_by_mac_addrs
211213 lookup_key = household_id_or_mac
212214 end
213215
214216 if not lookup_key and bad_key_part then
215217 log .error (string.format (" Invalid Unique Key Part: %s" , bad_key_part ))
216218 end
219+
217220 local maybe_existing = lookup_table [lookup_key ]
218221 if maybe_existing and maybe_existing .ssdp_info .expires_at > os.time () then
219222 reply_tx :send (maybe_existing )
220223 return
221224 end
222225
223- local waiting_for_player = self . waiting_for_unique_key [lookup_key ] or {}
226+ local waiting_for_player = self [ wait_table_key ] [lookup_key ] or {}
224227 table.insert (waiting_for_player , reply_tx )
225- self . waiting_for_unique_key [lookup_key ] = waiting_for_player
228+ self [ wait_table_key ] [lookup_key ] = waiting_for_player
226229 self :refresh ()
227230end
228231
0 commit comments