def unregisterIaClient(self, channel): """ Unregister an Ia client connection: - purge its subscriptions, if any, - purge its probe locks, if any, - remove it from the known clients. """ self._lock() for (uri, clients) in self._subscriptions.items(): if channel in clients: clients.remove(channel) # Garbage collection if len(clients) == 0: del self._subscriptions[uri] if channel in self._iaClients: self._iaClients.remove(channel) # Locks unlockedUris = [] for probe in self._probes.values(): if probe['locks'].has_key(channel): del probe['locks'][channel] # Keep it for unlocking notification outside the critical section unlockedUris.append(probe['uri']) self._unlock() for uri in unlockedUris: self.getLogger().info("channel %s unlocked probe %s (on channel disconnection)" % (str(channel), uri)) # Now sends an event over Ia to notify the new state notification = Messages.Notification("PROBE-EVENT", "system:probes", "Ia", "1.0") notification.setHeader("Reason", "probe-unlocked") notification.setApplicationBody({ 'uri': uri }) self._dispatchNotification(notification) CounterManager.instance().dec("server.tacs.iachannels.current")
def unregisterXcClient(self, channel): self.getLogger().info("Client %s disconnected from Xc" % str(channel)) self._lock() for (uri, clients) in self._subscriptions.items(): if channel in clients: clients.remove(channel) # Garbage collection if len(clients) == 0: del self._subscriptions[uri] if channel in self._xcClients: self._xcClients.remove(channel) self._unlock() self.getLogger().debug("Client %s purged from Xc registered clients" % str(channel)) CounterManager.instance().dec("server.ts.xcchannels.current")
def registerIaClient(self, channel): self._lock() self._iaClients.append(channel) self._unlock() CounterManager.instance().inc("server.tacs.iachannels.current")
def registerXcClient(self, channel): self.getLogger().info("New channel %s connected on Xc" % str(channel)) self._lock() self._xcClients.append(channel) self._unlock() CounterManager.instance().inc("server.ts.xcchannels.current")