~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/server.py

  • Committer: John Arbash Meinel
  • Date: 2011-09-23 17:08:11 UTC
  • mto: This revision was merged to the branch mainline in revision 6170.
  • Revision ID: john@arbash-meinel.com-20110923170811-gvo7k8ufg18lawan
If someone does manage to connect while we are shutting down, close the connection.
Also, check if the server already knows its stopped, rather than waiting on the connection.
(It can take a second or so for the OS to say that it really cannot connect to a closed socket.)

There is one more failure now.
Specifically: test_graceful_shutdown_waits_for_clients_to_stop.
Because server._stop_gracefully() now tells client handlers to _stop_gracefully, and we
don't actually have an active rpc in progress, the client can stop before we test
that the server is waiting for it to stop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
                            trace.warning("listening socket error: %s", e)
222
222
                    else:
223
223
                        if self._should_terminate:
 
224
                            conn.close()
224
225
                            break
225
226
                        self.serve_conn(conn, thread_name_suffix)
226
227
                    # Cleanout any threads that have finished processing.