[MERGE] sftp cleanup failures

Robey Pointer robey at lag.net
Thu Jan 11 07:35:38 GMT 2007


On 4 Jan 2007, at 13:02, John Arbash Meinel wrote:

> I don't think I saw this email, but your change seems pretty good, and
> it seems like something we should merge.
>
> Does anyone have a problem with it?
>
> I'm sending it again so that BB can notice it.

I guess that didn't work. :)  Is it too late to just merge it in with  
your existing patch?

robey


> === modified file 'bzrlib/transport/sftp.py'
> --- bzrlib/transport/sftp.py	2006-09-18 07:58:41 +0000
> +++ bzrlib/transport/sftp.py	2006-11-13 04:25:52 +0000
> @@ -910,10 +909,13 @@
>          self._socket.listen(1)
>          self.port = self._socket.getsockname()[1]
>          self._stop_event = threading.Event()
> +        self._open_sockets = []
>
>      def stop(self):
>          # called from outside this thread
>          self._stop_event.set()
> +        for socket in self._open_sockets:
> +            socket.close()
>          # use a timeout here, because if the test fails, the  
> server thread may
>          # never notice the stop_event.
>          self.join(5.0)
> @@ -929,6 +931,7 @@
>                  continue
>              try:
>                  s, addr_unused = self._socket.accept()
> +                self._open_sockets.append(s)
>                  # because the loopback socket is inline, and  
> transports are
>                  # never explicitly closed, best to launch a new  
> thread.
>                  threading.Thread(target=self._callback, args= 
> (s,)).start()
> @@ -1083,7 +1086,6 @@
>          if sys.platform == 'win32':
>              self._root = ''
>          self._listener = SocketListener(self._run_server_entry)
> -        self._listener.setDaemon(True)
>          self._listener.start()
>
>      def tearDown(self):
>




More information about the bazaar mailing list