~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_server.py

  • Committer: Martin Pool
  • Date: 2011-11-18 05:13:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6277.
  • Revision ID: mbp@canonical.com-20111118051319-9cj53bg5e06zl7rw
Remove more lzma related code

Show diffs side-by-side

added added

removed removed

Lines of Context:
432
432
    def get_request(self):
433
433
        """Get the request and client address from the socket."""
434
434
        sock, addr = TestingTCPServerMixin.get_request(self)
435
 
        # The thread is not created yet, it will be updated in process_request
 
435
        # The thread is not create yet, it will be updated in process_request
436
436
        self.clients.append((sock, addr, None))
437
437
        return sock, addr
438
438
 
439
 
    def process_request_thread(self, started, detached, stopped,
440
 
                               request, client_address):
 
439
    def process_request_thread(self, started, stopped, request, client_address):
441
440
        started.set()
442
 
        # We will be on our own once the server tells us we're detached
443
 
        detached.wait()
444
441
        SocketServer.ThreadingTCPServer.process_request_thread(
445
442
            self, request, client_address)
446
443
        self.close_request(request)
449
446
    def process_request(self, request, client_address):
450
447
        """Start a new thread to process the request."""
451
448
        started = threading.Event()
452
 
        detached = threading.Event()
453
449
        stopped = threading.Event()
454
450
        t = TestThread(
455
451
            sync_event=stopped,
456
452
            name='%s -> %s' % (client_address, self.server_address),
457
 
            target = self.process_request_thread,
458
 
            args = (started, detached, stopped, request, client_address))
 
453
            target=self.process_request_thread,
 
454
            args=(started, stopped, request, client_address))
459
455
        # Update the client description
460
456
        self.clients.pop()
461
457
        self.clients.append((request, client_address, t))
464
460
        t.set_ignored_exceptions(self.ignored_exceptions)
465
461
        t.start()
466
462
        started.wait()
 
463
        if debug_threads():
 
464
            sys.stderr.write('Client thread %s started\n' % (t.name,))
467
465
        # If an exception occured during the thread start, it will get raised.
 
466
        # In rare cases, an exception raised during the request processing may
 
467
        # also get caught here (see http://pad.lv/869366)
468
468
        t.pending_exception()
469
 
        if debug_threads():
470
 
            sys.stderr.write('Client thread %s started\n' % (t.name,))
471
 
        # Tell the thread, it's now on its own for exception handling.
472
 
        detached.set()
473
469
 
474
470
    # The following methods are called by the main thread
475
471