allow super() on TCPServer, add thread names for better debugging

This commit is contained in:
Maximilian Hils 2014-02-15 23:16:28 +01:00
parent a72ae4d85c
commit c276b4294c
2 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import contrib.md5crypt as md5crypt from .contrib import md5crypt
import http import http
from argparse import Action, ArgumentTypeError from argparse import Action, ArgumentTypeError

View File

@ -380,7 +380,7 @@ class BaseHandler(SocketCloseMixin):
class TCPServer: class TCPServer(object):
request_queue_size = 20 request_queue_size = 20
def __init__(self, address): def __init__(self, address):
self.address = Address.wrap(address) self.address = Address.wrap(address)
@ -416,7 +416,10 @@ class TCPServer:
connection, client_address = self.socket.accept() connection, client_address = self.socket.accept()
t = threading.Thread( t = threading.Thread(
target = self.connection_thread, target = self.connection_thread,
args = (connection, client_address) args = (connection, client_address),
name = "ConnectionThread (%s:%s -> %s:%s)" %
(client_address[0], client_address[1],
self.address.host, self.address.port)
) )
t.setDaemon(1) t.setDaemon(1)
t.start() t.start()