diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index 63f858c7fc..b6e2d4aafc 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -32,7 +32,7 @@ class AstronInternalRepository(ConnectionRepository): maxChannels = self.config.GetInt('air-channel-allocation', 1000000) self.channelAllocator = UniqueIdAllocator(baseChannel, baseChannel+maxChannels-1) - self.ourChannel = self.channelAllocator.allocate() + self.ourChannel = self.allocateChannel() self.eventLogId = self.config.GetString('eventlog-id', 'AIR:%d' % self.ourChannel) self.eventSocket = None @@ -46,6 +46,23 @@ class AstronInternalRepository(ConnectionRepository): self.readDCFile(dcFileNames) + def allocateChannel(self): + """ + Allocate an unused channel out of this AIR's configured channel space. + + This is also used to allocate IDs for DistributedObjects, since those + occupy a channel. + """ + + return self.channelAllocator.allocate() + + def deallocateChannel(self, channel): + """ + Return the previously-allocated channel back to the allocation pool. + """ + + self.channelAllocator.free(channel) + def setEventLogHost(self, host, port=7197): """ Set the target host for Event Logger messaging. This should be pointed