示例#1
0
文件: redis.py 项目: hubo1016/vlcp
 def __init__(self):
     '''
     Constructor
     '''
     Protocol.__init__(self)
     self.usehiredis = hiredis_available and self.hiredis
     self._format_request_init(self.encoding)
示例#2
0
文件: redis.py 项目: versee/vlcp
 def __init__(self):
     '''
     Constructor
     '''
     Protocol.__init__(self)
     self.usehiredis = hiredis_available and self.hiredis
     self._format_request_init(self.encoding)
示例#3
0
 def __init__(self, allowedVersions=None):
     '''
     Constructor
     '''
     Protocol.__init__(self)
     if allowedVersions is not None:
         self.allowedversions = allowedVersions
示例#4
0
文件: openflow.py 项目: hubo1016/vlcp
 def __init__(self, allowedVersions = None):
     '''
     Constructor
     '''
     Protocol.__init__(self)
     if allowedVersions is not None:
         self.allowedversions = allowedVersions
示例#5
0
 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
示例#6
0
 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
示例#7
0
文件: raw.py 项目: vtanrun/vlcp
 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
示例#8
0
文件: jsonrpc.py 项目: hubo1016/vlcp
 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
示例#9
0
文件: raw.py 项目: dq5070410/vlcp
 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
示例#10
0
 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
示例#11
0
文件: redis.py 项目: versee/vlcp
 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
示例#12
0
文件: openflow.py 项目: hubo1016/vlcp
 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
示例#13
0
文件: raw.py 项目: dq5070410/vlcp
 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
示例#14
0
文件: redis.py 项目: versee/vlcp
 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
示例#15
0
文件: redis.py 项目: versee/vlcp
 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
示例#16
0
文件: raw.py 项目: hubo1016/vlcp
 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
示例#17
0
文件: raw.py 项目: missuzhang/vlcp
 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
示例#18
0
 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
示例#19
0
文件: testio.py 项目: dq5070410/vlcp
 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
示例#20
0
文件: jsonrpc.py 项目: vtanrun/vlcp
 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
示例#21
0
 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
示例#22
0
文件: jsonrpc.py 项目: versee/vlcp
 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
示例#23
0
文件: jsonrpc.py 项目: hubo1016/vlcp
 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
示例#24
0
文件: redis.py 项目: hubo1016/vlcp
 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
示例#25
0
文件: redis.py 项目: versee/vlcp
 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
示例#26
0
文件: openflow.py 项目: hubo1016/vlcp
 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
示例#27
0
文件: testio.py 项目: vtanrun/vlcp
 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
示例#28
0
 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
示例#29
0
 def __init__(self):
     '''
     Constructor
     '''
     Protocol.__init__(self)
示例#30
0
文件: raw.py 项目: hubo1016/vlcp
 def __init__(self):
     """
     Constructor
     """
     Protocol.__init__(self)
示例#31
0
文件: testio.py 项目: dq5070410/vlcp
 def error(self, connection):
     for m in Protocol.closed(self, connection):
         yield m
     for m in connection.waitForSend(TestConnectionEvent(TestConnectionEvent.DOWN, connection)):
         yield m
示例#32
0
文件: testio.py 项目: vtanrun/vlcp
 def error(self, connection):
     for m in Protocol.closed(self, connection):
         yield m
     for m in connection.waitForSend(
             TestConnectionEvent(TestConnectionEvent.DOWN, connection)):
         yield m
示例#33
0
文件: redis.py 项目: hubo1016/vlcp
 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
示例#34
0
文件: jsonrpc.py 项目: hubo1016/vlcp
 def __init__(self):
     '''
     Constructor
     '''
     Protocol.__init__(self)
示例#35
0
 def init(self, connection):
     for m in Protocol.init(self, connection):
         yield m
     for m in self.reconnect_init(connection):
         yield m
示例#36
0
 def init(self, connection):
     for m in Protocol.init(self, connection):
         yield m
     for m in self.reconnect_init(connection):
         yield m
示例#37
0
文件: redis.py 项目: hubo1016/vlcp
 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