コード例 #1
0
ファイル: ModbusService.py プロジェクト: UHH-ISS/honeygrove
    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
コード例 #2
0
ファイル: tx.py プロジェクト: reorx/protobuf-rpc.bak
 def buildProtocol(self, addr):
     p = ProtocolWrapper(self, self.protocol())
     p._services = self._services
     return p