当前位置: 首页>>代码示例>>Python>>正文


Python LineReceiver.connectionLost方法代码示例

本文整理汇总了Python中twisted.protocols.basic.LineReceiver.connectionLost方法的典型用法代码示例。如果您正苦于以下问题:Python LineReceiver.connectionLost方法的具体用法?Python LineReceiver.connectionLost怎么用?Python LineReceiver.connectionLost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.protocols.basic.LineReceiver的用法示例。


在下文中一共展示了LineReceiver.connectionLost方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, reason):
     """
     Cause any outstanding commands to fail.
     """
     self._disconnected = True
     self._cancelCommands(reason)
     LineReceiver.connectionLost(self, reason)
开发者ID:JohnDoes95,项目名称:project_parser,代码行数:9,代码来源:memcache.py

示例2: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, why):
     self.connected = 0
     self.script_hashes.clear()
     self.factory.delConnection(self)
     LineReceiver.connectionLost(self, why)
     while self.replyQueue.waiting:
         self.replyReceived(ConnectionError("Lost connection"))
开发者ID:anthonyalmarza,项目名称:trex,代码行数:9,代码来源:protocols.py

示例3: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
		def connectionLost(self, reason):
			""" ups... stop reactor """
			LineReceiver.connectionLost(self, reason)
			print "Connection lost: ", reason.getErrorMessage()
			try:
				reactor.stop()
			except ReactorNotRunning:
				print " - reactor not running, so we are not stopping it" 
开发者ID:nickers,项目名称:sw-dolev,代码行数:10,代码来源:communication_client.py

示例4: PostgresMonitor

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
class PostgresMonitor(ProcessProtocol):
    """
    A monitoring protocol which watches the postgres subprocess.
    """
    log = Logger()

    def __init__(self, svc=None):
        self.lineReceiver = LineReceiver()
        self.lineReceiver.delimiter = '\n'
        self.lineReceiver.lineReceived = self.lineReceived
        self.svc = svc
        self.isReady = False
        self.completionDeferred = Deferred()


    def lineReceived(self, line):
        if self.svc is None:
            return
        if not self.isReady:
            if _MAGIC_READY_COOKIE in line:
                self.svc.ready()

    disconnecting = False


    def connectionMade(self):
        self.lineReceiver.makeConnection(self)


    def outReceived(self, out):
        for line in out.split("\n"):
            if line:
                self.log.info("{message}", message=line)
        # self.lineReceiver.dataReceived(out)


    def errReceived(self, err):
        for line in err.split("\n"):
            if line:
                self.log.error("{message}", message=line)
        self.lineReceiver.dataReceived(err)


    def processEnded(self, reason):
        self.log.info(
            "pg_ctl process ended with status={status}",
            status=reason.value.status
        )
        # If pg_ctl exited with zero, we were successful in starting postgres
        # If pg_ctl exited with nonzero, we need to give up.
        self.lineReceiver.connectionLost(reason)

        if reason.value.status == 0:
            self.completionDeferred.callback(None)
        else:
            self.log.error("Could not start postgres; see postgres.log")
            self.completionDeferred.errback(reason)
开发者ID:red-hood,项目名称:calendarserver,代码行数:59,代码来源:subpostgres.py

示例5: _PostgresMonitor

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
class _PostgresMonitor(ProcessProtocol):
    """
    A monitoring protocol which watches the postgres subprocess.
    """

    def __init__(self, svc=None):
        self.lineReceiver = LineReceiver()
        self.lineReceiver.delimiter = '\n'
        self.lineReceiver.lineReceived = self.lineReceived
        self.svc = svc
        self.isReady = False
        self.completionDeferred = Deferred()


    def lineReceived(self, line):
        if self.svc is None:
            return
        if not self.isReady:
            if _MAGIC_READY_COOKIE in line:
                self.svc.ready()

    disconnecting = False


    def connectionMade(self):
        self.lineReceiver.makeConnection(self)


    def outReceived(self, out):
        log.msg("received postgres stdout %r" % (out,))
        # self.lineReceiver.dataReceived(out)


    def errReceived(self, err):
        log.msg("received postgres stderr %r" % (err,))
        self.lineReceiver.dataReceived(err)


    def processEnded(self, reason):
        log.msg("postgres process ended %r" % (reason,))
        result = (reason.value.status == 0)
        self.lineReceiver.connectionLost(reason)
        self.completionDeferred.callback(result)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:45,代码来源:subpostgres.py

示例6: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
    def connectionLost(self, reason=connectionDone):
        LineReceiver.connectionLost(self)
        self.transport_connected = False

        self.log("Transport disconnected")
开发者ID:danielkza,项目名称:mac0448-chat,代码行数:7,代码来源:__init__.py

示例7: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, reason):
     self.factory.unregisterConnection(self)
     LineReceiver.connectionLost(self, reason)
开发者ID:NielsZeilemaker,项目名称:gumby,代码行数:5,代码来源:sync.py

示例8: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, reason):
     msg("Lost connection with: %s with ID %s" % (str(self.transport.getPeer()), self.id), logLevel=logging.DEBUG)
     self.factory.unregisterConnection(self)
     LineReceiver.connectionLost(self, reason)
开发者ID:LipuFei,项目名称:gumby,代码行数:6,代码来源:sync.py

示例9: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, reason):
     LineReceiver.connectionLost(self, reason)
     print "connection lost"
开发者ID:wuzhe,项目名称:medicalook,代码行数:5,代码来源:medproto_client.py

示例10: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, reason=connectionDone):
     self.results_ready_deferred.callback(self.results)
     LineReceiver.connectionLost(self, reason=reason)
开发者ID:fdChasm,项目名称:cube-dev-auth-proxy,代码行数:5,代码来源:get_master_server_list.py

示例11: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, reason):
     print "a client disconnected ..."
     LineReceiver.connectionLost(self, reason)
     self.factory.clients.remove(self)
开发者ID:wuzhe,项目名称:medicalook,代码行数:6,代码来源:medproto.py

示例12: connectionLost

# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import connectionLost [as 别名]
 def connectionLost(self, reason):
     print "Network connection lost"
     LineReceiver.connectionLost(self, reason)
开发者ID:t2d,项目名称:pyanotel,代码行数:5,代码来源:pseudonym_provider.py


注:本文中的twisted.protocols.basic.LineReceiver.connectionLost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。