[MERGE] Avoid unnecessary reconnections to old servers when the first HPSS is an error in the right protocol version.

John Arbash Meinel john at arbash-meinel.com
Fri May 30 14:17:16 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Bennetts wrote:
| This patch fixes a bug reported on IRC.  If this first HPSS reply is an error
| reply in the protocol version we are expecting, then the protocol detection has
| succeeded and does not need to be repeated, but in bzr.dev the exception
| handling prevents this from working correctly.
|
| This happens in practice with at least 'bzr pull URL': it first tries
| to read the remote path as a file in case it is a bundle, but if it is a
| directory (e.g. because it is a branch), then the server will reply with a
| ReadError.
|
| It's potentionally a very serious correctness fix too: we end up re-issuing a
| request that the remote side has already received correctly.  In practice this
| seems to be harmless because if it causes an error response it probably didn't
| do anything interesting anyway, but it's good to make sure there's no room for
| nasty surprises here.
|
| There's a small amount of extra fluff in this patch to:
|
|  - make test_smart_transport pass with "bzr -Dhpss selftest -E allow_debug", and
|  - if -Dhpss is used, log a little more info about the protocol decoder's state
|    when an unexpected connection close/EOF occurs.
|
| -Andrew.
|
|

+            if 'hpss' in debug.debug_flags:
+                mutter(
+                    'decoder state: buf[:10]=%r, state_accept=%s',
+                    self._protocol_decoder._in_buffer[:10],
+                    self._protocol_decoder.state_accept.im_func.func_name)

^- Why use 'im_func.func_name' instead of just
state_accept.__name__
It seems the latter is a bit safer, in case we have a class instead of a
function, etc.

BB:tweak

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkg//lwACgkQJdeBCYSNAAN5SwCfXIMlbY9oxOL4IdfemXYnhUEV
kbwAoJ8mHeZn4QUMB0sxEoVJaAc4E20n
=UfiP
-----END PGP SIGNATURE-----



More information about the bazaar mailing list