close method for ConnectedTransport

Bug #579800 reported by Jonathan Lange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Unassigned

Bug Description

bzrlib would be way more useful if ConnectedTransport and its subclasses had a disconnect() or close() method that severed the connection.

Tags: api transport
Martin Pool (mbp)
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 579800] Re: close method for ConnectedTransport

Jono, can you expand on why this would make bzrlib easier to use -
transports as a whole work on a stateless-handle-to-a-directory model.
ConnectedTransport is a subclass that makes making transports which
can use a single backing tcp-or-other connection easier to write.
Other transports may have one (or more) external connections, and
ConnectedTransports might have no open connections, given the
open-as-needed model.

-Rob

Revision history for this message
Jonathan Lange (jml) wrote :

We use transports a lot in testing in Launchpad (I feel like I've filed this bug before, anyway...). For some of these tests, we actually require a genuine TCP disconnect. In one case, there's even application logic that's triggered by a disconnect.

I understand the transport model. Even so, we've wanted a disconnect() or close() method for over three years now. In the meantime, we've written our own crappy versions that break whenever transport implementation details change.

Revision history for this message
Martin Pool (mbp) wrote :

I think it's reasonable to want; I'm not sure if it should be on
Transport as such or whether we should expose a higher Connection
that's common across several of them.

Revision history for this message
Robert Collins (lifeless) wrote :

What makes your implementations crappy [what do we need to know, to
avoid doing, to have non-crappy ones]?

Revision history for this message
Jonathan Lange (jml) wrote :

On Thu, May 20, 2010 at 10:02 AM, Robert Collins
<email address hidden> wrote:
> What makes your implementations crappy [what do we need to know, to
> avoid doing, to have non-crappy ones]?
>

They are external to the transport object, but access _protected
attributes of the transport object.

Revision history for this message
Robert Collins (lifeless) wrote :

Ok, so nothing like 'can't get connections to stay closed' or 'a
closed transport should not be usable again' ?

Revision history for this message
Jonathan Lange (jml) wrote :

On Thu, May 20, 2010 at 10:39 AM, Robert Collins
<email address hidden> wrote:
> Ok, so nothing like 'can't get connections to stay closed' or 'a
> closed transport should not be usable again' ?

Nope. From our POV, we just use them for testing, and one transport
almost always == one connection.

jml

Jelmer Vernooij (jelmer)
tags: added: api transport
Revision history for this message
Vincent Ladeuil (vila) wrote :

disconnect() has been implemented while fixing thread/socket leaks.

Changed in bzr:
assignee: nobody → Vincent Ladeuil (vila)
assignee: Vincent Ladeuil (vila) → nobody
milestone: none → 2.3.0
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.