Ensure that allocated channels are reserved.

This was previously mostly working because the allocator itself was
moving forward, but since each radio has its own allocator, aircraft
with different radios would often get overlapping intra-flight
frequencies.
This commit is contained in:
Dan Albert 2020-09-12 12:27:03 -07:00
parent 2db740e1ad
commit 9e98f05be0

View File

@ -183,6 +183,7 @@ class RadioRegistry:
try:
while (channel := next(allocator)) in self.allocated_channels:
pass
self.reserve(channel)
return channel
except StopIteration:
raise OutOfChannelsError(radio)