transport layer and multiple connections (was Re: [PATCH] FTP transport)
John A Meinel
john at arbash-meinel.com
Sun Nov 20 04:11:59 GMT 2005
Matthieu Moy wrote:
> Daniel Silverstone <dsilvers at digital-scurf.org> writes:
>
>>> (I don't know whether this comes from the transport layer of from
>>> ftp.py itself, though)
>> The transport layer clones several times before it ever does anything,
>> which caused the connection to be created several times because it was
>> lazy. Now it's lazy but memoized safely.
>
> Actually, I believe this should be fixed in the transport layer
> itself. get_transport may be called several times with the same
> argument (an example in "push" :
>
> try:
> br_to = Branch.open(location) # <- calls get_transport(location)
> except NotBranchError:
> # create a branch.
> transport = get_transport(location).clone('..')
>
> )
>
> A relatively simple fix would be to keep a dictionary
> (location -> transport), and to reuse the existing one if it exists in
> get_location.
>
> The patch below does this, but it seems too obvious to be true. Is
> there a reason not to do it this way? Well, at least, a
> "push sftp://host.com/not/yet/created/directory" promps my password
> once instead of three times.
The reason we didn't use a specific dictionary is because we wanted
finer control over whether connections are kept alive or not. Long term
bzrlib needs to be designed that it can be loaded for a long time. It
may be used in a GUI (or even a server) that stays open for a long time,
rather than a command line program that runs frequently.
Also, I believe we wanted to do more about when you connect to a given
host + username, even if the path is different, you would want to reuse
the connection.
The idea was to switch to using a weak reference dictionary, for each
transport, which would know the special information.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051119/5c15ee7a/attachment.pgp
More information about the bazaar
mailing list