Rev 6172: pass fd in the 'check for errors' section of select. in http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797

John Arbash Meinel john at arbash-meinel.com
Fri Sep 16 13:49:02 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797

------------------------------------------------------------
revno: 6172
revision-id: john at arbash-meinel.com-20110916134853-e2jhw7td49nqpjmz
parent: john at arbash-meinel.com-20110916133736-c6sd2jrqus2vbvp9
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: drop-idle-connections-824797
timestamp: Fri 2011-09-16 15:48:53 +0200
message:
  pass fd in the 'check for errors' section of select.
  
  It doesn't seem to do anything, and I've never seen a value come out of it.
  Nobody has mentioned a way to trigger a failure, nor what to actually do
  if we see one. So for now, turn a returned 'errorfds' into an exception.
-------------- next part --------------
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2011-09-16 13:37:36 +0000
+++ b/bzrlib/smart/medium.py	2011-09-16 13:48:53 +0000
@@ -298,7 +298,7 @@
             poll_timeout = min(timeout_seconds, self._client_poll_timeout)
             rs = []
             while not rs and time.time() < t_end:
-                rs, _, _ = select.select([fd], [], [], poll_timeout)
+                rs, _, xs = select.select([fd], [], [fd], poll_timeout)
         except (select.error, socket.error) as e:
             err = getattr(e, 'errno', None)
             if err is None:
@@ -310,6 +310,11 @@
                 # socket, just return 'without timeout'
                 return False
             raise
+        if xs:
+            # I honestly don't know what to do here. Something is wrong with
+            # the file handle, but we don't know *what*.
+            raise errors.BzrError('select returned an error for fd: %s'
+                                  % (xs[0],))
         if rs:
             # We can read without blocking, we did not timeout.
             return False



More information about the bazaar-commits mailing list