]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Remove unused clients set
authorMichael V. DePalatis <mike@depalatis.net>
Fri, 12 Aug 2016 06:29:24 +0000 (08:29 +0200)
committerMichael V. DePalatis <mike@depalatis.net>
Fri, 12 Aug 2016 06:29:24 +0000 (08:29 +0200)
demos/tcpecho/server.py

index 369482f83a5f79a026f65c25b9a0e783cc7de174..bc0b054a4fde67826110192ee166c8ac22ed98d8 100644 (file)
@@ -6,14 +6,12 @@ from tornado.tcpserver import TCPServer
 from tornado.options import options, define
 
 define("port", default=9888, help="TCP port to listen on")
-clients = set()
 logger = logging.getLogger(__name__)
 
 
 class EchoServer(TCPServer):
     @gen.coroutine
     def handle_stream(self, stream, address):
-        clients.add(address)
         while True:
             try:
                 data = yield stream.read_until(b"\n")
@@ -22,7 +20,6 @@ class EchoServer(TCPServer):
                     data = data + b"\n"
                 yield stream.write(data)
             except StreamClosedError:
-                clients.remove(address)
                 logger.warning("Lost client at host %s", address[0])
                 break
             except Exception as e: