本文整理汇总了Python中twisted.internet.protocol.Factory.messageProcessor方法的典型用法代码示例。如果您正苦于以下问题:Python Factory.messageProcessor方法的具体用法?Python Factory.messageProcessor怎么用?Python Factory.messageProcessor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.protocol.Factory
的用法示例。
在下文中一共展示了Factory.messageProcessor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _listen
# 需要导入模块: from twisted.internet.protocol import Factory [as 别名]
# 或者: from twisted.internet.protocol.Factory import messageProcessor [as 别名]
def _listen(self):
factory = Factory()
factory.protocol = FaultManagerProtocol
factory.messageProcessor = self
point = TCP4ServerEndpoint(reactor, self._port)
d = point.listen(factory)
d.addErrback(self._onListenError)
示例2: _connectToFaultManager
# 需要导入模块: from twisted.internet.protocol import Factory [as 别名]
# 或者: from twisted.internet.protocol.Factory import messageProcessor [as 别名]
def _connectToFaultManager(self):
factory = Factory()
factory.protocol = ServerProtocol
factory.messageProcessor = self
factory.onConnect = self.connectedToFaultManager
factory.onDisconnect = self.disconnectedFromFaultManager
point = TCP4ClientEndpoint(reactor, self._faultManagerAddress, self._faultManagerPort)
d = point.connect(factory)
d.addErrback(self._onListenError)
示例3: _listen
# 需要导入模块: from twisted.internet.protocol import Factory [as 别名]
# 或者: from twisted.internet.protocol.Factory import messageProcessor [as 别名]
def _listen(self):
factory = Factory()
factory.protocol = ServerProtocol
factory.messageProcessor = self
factory.onConnect = self.clientConnected
factory.onDisconnect = self.clientDisconnected
point = TCP4ServerEndpoint(reactor, self._localPort)
d = point.listen(factory)
d.addErrback(self._onListenError)
示例4: _backupState
# 需要导入模块: from twisted.internet.protocol import Factory [as 别名]
# 或者: from twisted.internet.protocol.Factory import messageProcessor [as 别名]
def _backupState(self):
for (address, port) in self._replicaList:
if not (address == self._localAddress and port == self._localPort): #don't connect to ourselves
factory = Factory()
factory.protocol = ServerProtocol
factory.messageProcessor = self
factory.onConnect = self.connectedToBackup
factory.onDisconnect = None
point = TCP4ClientEndpoint(reactor, address, port, timeout=2)
d = point.connect(factory)
示例5: _connectToReplica
# 需要导入模块: from twisted.internet.protocol import Factory [as 别名]
# 或者: from twisted.internet.protocol.Factory import messageProcessor [as 别名]
def _connectToReplica(self):
if self._replicaIndexToAttempt < len(self._replicaList):
factory = Factory()
factory.protocol = ClientProtocol
factory.messageProcessor = self
factory.onConnect = self.connectedToServerReplica
factory.onDisconnect = self.disconnectedFromServerReplica
(replicaAddress, replicaPort) = self._replicaList[self._replicaIndexToAttempt]
print "Connecting to primary replica", replicaAddress + ":" + str(replicaPort)
point = TCP4ClientEndpoint(reactor, replicaAddress, replicaPort)
d = point.connect(factory)
d.addErrback(self._onServerReplicaConnectError)
self._replicaIndexToAttempt += 1
else:
#if we run out of replicas, send OperationComplete with result set to None
#so that performOperation will raise an exception
self._operationCompleteCondition.acquire()
self._operationResult = None
self._operationCompleteCondition.notifyAll()
self._operationCompleteCondition.release()