def buildProtocol(self, addr): if (self.connectionLimit is None or self.connectionCount < self.connectionLimit): # Build the normal protocol wrappedProtocol = self.protocol() elif self.overflowProtocol is None: # Just drop the connection log.limit_reached(Config.modbus.name, str(addr)) return None else: # Too many connections, so build the overflow protocol wrappedProtocol = self.overflowProtocol() wrappedProtocol.factory = self protocol = ProtocolWrapper(self, wrappedProtocol) self.connectionCount += 1 return protocol
def buildProtocol(self, addr): p = ProtocolWrapper(self, self.protocol()) p._services = self._services return p