[MERGE] Ensure failed operations leave remote transport in clean state

Aaron Bentley aaron.bentley at utoronto.ca
Mon Sep 3 15:40:06 BST 2007


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

Martin Pool wrote:
> Martin Pool has voted comment.
> Status is now: Semi-approved
> Comment:
> +                assert new_char != '', "end of file reading from server."
> 
> I realize this is existing code and not Aaron's fault, but this should
> really be an if/raise, not an assertion, as it is be trying to find
> environmental errors, not logic errors.

Fully agreed.  If you run this with assertions disabled and the name
lookup fails, you get an infinite loop!

> Strangely it looks like SmartMedium.disconnect does nothing at present,
> which is probably wrong. :-) But you're not wrong to call it.
> 
> I think that if we've encountered an arbitrary unexpected error, it is
> not safe to just say that the medium is done.  Anything might have
> happened at this point.  It might be better to just mark it as being in
> an invalid/broken state, and then have them refuse to be reused then?

You can have them refuse to be reused, but that's an API change.  Or you
can ensure they always end up in a reusable state, even if it's a state
equivalent to being freshly-initted.

I think the second is easier to use, and I don't really see disadvantages.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG3BzG0F+nu1YWqI0RAqTFAJ9OdPgSJVZf5lJFkxdEfRL0qzckPQCfU/m0
2FMKRRd/cyXAwc4DOX/II2w=
=nEBA
-----END PGP SIGNATURE-----



More information about the bazaar mailing list