Sftp type error #49363
John Arbash Meinel
john at arbash-meinel.com
Thu Jun 15 03:43:41 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robey Pointer wrote:
>
> On 12 Jun 2006, at 7:55, John Arbash Meinel wrote:
>
...
> I think I accidentally fixed the 5-second delay with my patch to let the
> stub sftp server handle multiple connections per test. I attached it to
> a bug on launchpad a few weeks ago, but I can't look it up right now so
> I'll attach the patch here too.
>
> The timing on the tests is pretty random, but when I watch 'selftest
> SFTP', without the patch the SKIP stays up for several seconds. With
> the patch, it skips past quickly.
>
> robey
...
> + def run(self):
> + while True:
> + readable, _, _ = select.select([self._socket], [], [], 0.1)
> + if self._stop_event.isSet():
> + return
> + if len(readable) == 0:
> + continue
> + try:
> + s, _ = self._socket.accept()
> + # 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()
> + except socket.error, x:
> + pass #Ignore socket errors
> + except Exception, x:
> + # probably a failed test
> + sys.excepthook(*sys.exc_info())
> + warning('Exception from within unit test server thread: %r' % x)
I personally don't like the look of the '_' variable names, though I
understand it is because you are ignoring the return value.
Perhaps 'dummy', though I wouldn't block on it.
Is select.select() portable across platforms?
Any reason not to use asyncore instead?
Otherwise it would be very nice to fix all of the timeout problems.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEkMldJdeBCYSNAAMRAm+dAKC7wN+Drk6DIz1i+n3fqFIPfM3GLQCfVv1d
vDsksL0sDij/IdGgZR+bpcY=
=yh5Q
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list