wsgiserver3.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:CloudPrint 作者: William-An 项目源码 文件源码
def close(self):
        """Close the socket underlying this connection."""
        self.rfile.close()

        if not self.linger:
            # Python's socket module does NOT call close on the kernel
            # socket when you call socket.close(). We do so manually here
            # because we want this server to send a FIN TCP segment
            # immediately. Note this must be called *before* calling
            # socket.close(), because the latter drops its reference to
            # the kernel socket.
            # Python 3 *probably* fixed this with socket._real_close;
            # hard to tell.
# self.socket._sock.close()
            self.socket.close()
        else:
            # On the other hand, sometimes we want to hang around for a bit
            # to make sure the client has a chance to read our entire
            # response. Skipping the close() calls here delays the FIN
            # packet until the socket object is garbage-collected later.
            # Someday, perhaps, we'll do the full lingering_close that
            # Apache does, but not today.
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号