def __init__(self, db, sock): asynchat.async_chat.__init__(self, sock=sock) self._sock = sock self._db = db self._buffer = ProtocolBuffer() self.set_terminator('\r\n') self.rfile = cStringIO.StringIO() self.found_terminator = self.handle_request # get the queue index associated with this client # connection self._qindex = self._db.get_queue() # number of outstanding requests self._outstand = 0 self._lock = threading.Lock()