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


Python WSGIServer.server_close方法代码示例

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


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

示例1: server_close

# 需要导入模块: from wsgiref.simple_server import WSGIServer [as 别名]
# 或者: from wsgiref.simple_server.WSGIServer import server_close [as 别名]
 def server_close(self):
     """
     Properly initiate closing handshakes on
     all websockets when the WSGI server terminates.
     """
     print "closing sockets"
     _WSGIServer.server_close(self)
开发者ID:dls-controls,项目名称:malcolm,代码行数:9,代码来源:wsserversocket.py

示例2: server_close

# 需要导入模块: from wsgiref.simple_server import WSGIServer [as 别名]
# 或者: from wsgiref.simple_server.WSGIServer import server_close [as 别名]
 def server_close(self):
     """
     Properly initiate closing handshakes on
     all websockets when the WSGI server terminates.
     """
     if hasattr(self, 'manager'):
         self.manager.close_all()
         self.manager.stop()
         self.manager.join()
         delattr(self, 'manager')
     _WSGIServer.server_close(self)
开发者ID:Anderson-Juhasc,项目名称:bitex,代码行数:13,代码来源:wsgirefserver.py

示例3: _HTTPServer

# 需要导入模块: from wsgiref.simple_server import WSGIServer [as 别名]
# 或者: from wsgiref.simple_server.WSGIServer import server_close [as 别名]
class _HTTPServer(bottle.ServerAdapter):
    """
    Reimplement bottle's WSGIRefServer. Override the request handler class and
    add a stop() method for cleanly shutting down the server.
    """
    srv = None
    app = None

    def run(self, handler):
        # Handle the TIME_WAIT state for quick server restarts
        WSGIServer.allow_reuse_address = 1

        # Create the server and start it
        self.srv = WSGIServer((self.host, self.port), _HTTPRequestHandler)
        self.srv.set_app(self.app)
        try:
            self.srv.serve_forever()
        finally:
            self.srv.server_close()

    def stop(self):
        if self.srv:
            self.srv.shutdown()
开发者ID:dtroyer,项目名称:dwarf,代码行数:25,代码来源:api_server.py


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