def __init__(self): ''' Constructor ''' Protocol.__init__(self) self.usehiredis = hiredis_available and self.hiredis self._format_request_init(self.encoding)
def __init__(self, allowedVersions=None): ''' Constructor ''' Protocol.__init__(self) if allowedVersions is not None: self.allowedversions = allowedVersions
def __init__(self, allowedVersions = None): ''' Constructor ''' Protocol.__init__(self) if allowedVersions is not None: self.allowedversions = allowedVersions
def __init__(self, allowedVersions = None): ''' Constructor :param allowedVersions: if specified, should be a tuple of allowed OpenFlow versions. ''' Protocol.__init__(self) if allowedVersions is not None: self.allowedversions = allowedVersions
def __init__(self, allowedVersions=None): ''' Constructor :param allowedVersions: if specified, should be a tuple of allowed OpenFlow versions. ''' Protocol.__init__(self) if allowedVersions is not None: self.allowedversions = allowedVersions
def init(self, connection): for m in Protocol.init(self, connection): yield m connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, RawConnectionStateEvent.createMatcher(connection = connection), ('connstate', connection))) for m in self.reconnect_init(connection): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m connection.scheduler.ignore(JsonRPCRequestEvent.createMatcher(connection = connection)) self._logger.warning('JSON-RPC connection is reset on %r', connection) for m in connection.waitForSend(JsonRPCConnectionStateEvent(JsonRPCConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m for m in connection.waitForSend( MyProtocolConnectionStateEvent( MyProtocolConnectionStateEvent.DOWN, connection, connection.connmark, self)): yield m
def notconnected(self, connection): for m in Protocol.notconnected(self, connection): yield m for m in connection.waitForSend( RedisConnectionStateEvent( RedisConnectionStateEvent.CONNECTION_NOTCONNECTED, connection, connection.connmark, self)): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m connection.handler.close() self._logger.warning('Openflow connection is reset on %r', connection) if connection.openflow_datapathid is not None: for m in connection.waitForSend(OpenflowConnectionStateEvent(connection.openflow_datapathid, connection.openflow_auxiliaryid, OpenflowConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m for m in connection.inputstream.error(connection, True): yield m connection.terminate(connection._raw_writer) connection._raw_writer = None for m in connection.waitForSend(RawConnectionStateEvent(RawConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def closed(self, connection): for m in Protocol.closed(self, connection): yield m self._logger.info('Redis connection is closed on %r', connection) for m in connection.waitForSend( RedisConnectionStateEvent( RedisConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m self._logger.warning('Redis connection is reset on %r', connection) for m in connection.waitForSend( RedisConnectionStateEvent( RedisConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def notconnected(self, connection): for m in Protocol.notconnected(self, connection): yield m for m in connection.waitForSend( RawConnectionStateEvent( RawConnectionStateEvent.CONNECTION_NOTCONNECTED, connection, connection.connmark, self ) ): yield m
def init(self, connection): for m in Protocol.init(self, connection): yield m if not self.server: connection.subroutine(connection.executeWithTimeout(self.totalsend + 1.0, self._clientroutine(connection)), False, 'protocolroutine') else: for m in connection.write(ConnectionWriteEvent(connection, connection.connmark, data = b'', EOF = True)): yield m for m in connection.waitForSend(TestConnectionEvent(TestConnectionEvent.UP, connection)): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m connection.scheduler.ignore( JsonRPCRequestEvent.createMatcher(connection=connection)) self._logger.warning('JSON-RPC connection is reset on %r', connection) for m in connection.waitForSend( JsonRPCConnectionStateEvent( JsonRPCConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m connection.handler.close() self._logger.warning('Openflow connection is reset on %r', connection) if connection.openflow_datapathid is not None: for m in connection.waitForSend( OpenflowConnectionStateEvent( connection.openflow_datapathid, connection.openflow_auxiliaryid, OpenflowConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def init(self, connection): for m in Protocol.init(self, connection): yield m connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, JsonRPCRequestEvent.createMatcher(connection = connection), ('request', connection), self.messagequeuesize)) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, JsonRPCConnectionStateEvent.createMatcher(connection = connection), ('connstate', connection))) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority + 1, JsonRPCResponseEvent.createMatcher(connection = connection), ('response', connection), self.messagequeuesize)) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, JsonRPCNotificationEvent.createMatcher(connection = connection), ('notification', connection), self.messagequeuesize)) for m in self.reconnect_init(connection): yield m
def init(self, connection): for m in Protocol.init(self, connection): yield m connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority - 1, RedisConnectionStateEvent.createMatcher(connection = connection), ('connstate', connection))) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority + 1, RedisResponseEvent.createMatcher(connection = connection), ('response', connection), self.messagequeuesize)) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority + 1, RedisSubscribeEvent.createMatcher(connection = connection), ('subscribe', connection), self.messagequeuesize)) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, RedisSubscribeMessageEvent.createMatcher(connection = connection), ('message', connection), self.messagequeuesize)) connection.redis_subscribe = False connection.redis_select = None connection.redis_subscribe_keys = set() connection.redis_subscribe_pkeys = set() for m in self.reconnect_init(connection): yield m
def init(self, connection): for m in Protocol.init(self, connection): yield m connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, OpenflowPresetupMessageEvent.createMatcher(connection = connection), ('presetup', connection))) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, OpenflowConnectionStateEvent.createMatcher(connection = connection), ('connstate', connection))) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority + 1, OpenflowResponseEvent.createMatcher(connection = connection), ('response', connection), self.messagequeuesize)) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, OpenflowAsyncMessageEvent.createMatcher(connection = connection), ('async', connection), self.messagequeuesize)) connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.messagepriority, OpenflowExperimenterMessageEvent.createMatcher(connection = connection), ('experimenter', connection), self.messagequeuesize)) # Add priority to echo reply, or the whole connection is down connection.createdqueues.append(connection.scheduler.queue.addSubQueue(\ self.writepriority + 10, ConnectionWriteEvent.createMatcher(connection = connection, _ismatch = lambda x: hasattr(x, 'echoreply') and x.echoreply), ('echoreply', connection))) for m in self.reconnect_init(connection): yield m
def init(self, connection): for m in Protocol.init(self, connection): yield m if not self.server: connection.subroutine( connection.executeWithTimeout(self.totalsend + 1.0, self._clientroutine(connection)), False, 'protocolroutine') else: for m in connection.write( ConnectionWriteEvent(connection, connection.connmark, data=b'', EOF=True)): yield m for m in connection.waitForSend( TestConnectionEvent(TestConnectionEvent.UP, connection)): yield m
def __init__(self): ''' Constructor ''' Protocol.__init__(self)
def __init__(self): """ Constructor """ Protocol.__init__(self)
def error(self, connection): for m in Protocol.closed(self, connection): yield m for m in connection.waitForSend(TestConnectionEvent(TestConnectionEvent.DOWN, connection)): yield m
def error(self, connection): for m in Protocol.closed(self, connection): yield m for m in connection.waitForSend( TestConnectionEvent(TestConnectionEvent.DOWN, connection)): yield m
def error(self, connection): for m in Protocol.error(self, connection): yield m self._logger.warning('Redis connection is reset on %r', connection) for m in connection.waitForSend(RedisConnectionStateEvent(RedisConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m
def init(self, connection): for m in Protocol.init(self, connection): yield m for m in self.reconnect_init(connection): yield m
def closed(self, connection): for m in Protocol.closed(self, connection): yield m self._logger.info('Redis connection is closed on %r', connection) for m in connection.waitForSend(RedisConnectionStateEvent(RedisConnectionStateEvent.CONNECTION_DOWN, connection, connection.connmark, self)): yield m