Merge ~cjwatson/turnip:loseWriteConnection-test-failure into turnip:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 657ecf170fb2f1d85cae2d2ce6f07676a5e2ca8c
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/turnip:loseWriteConnection-test-failure
Merge into: turnip:master
Diff against target: 25 lines (+3/-2)
2 files modified
turnip/pack/git.py (+1/-1)
turnip/pack/ssh.py (+2/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Tom Wardill (community) Approve
Review via email: mp+357691@code.launchpad.net

Commit message

Check if transport is connected before closing it

We've seen occasional test failures in `loseWriteConnection` calls for
some time because the socket had already been closed, and they've become
much more frequent of late. Checking whether the transport is still
connected before telling it to lose its write connection should help.

LP: #1641100

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/turnip/pack/git.py b/turnip/pack/git.py
2index c18742f..d45e1db 100644
3--- a/turnip/pack/git.py
4+++ b/turnip/pack/git.py
5@@ -381,7 +381,7 @@ class PackProxyServerProtocol(PackServerProtocol):
6
7 def readConnectionLost(self):
8 # Forward the closed stdin down the stack.
9- if self.peer is not None:
10+ if self.peer is not None and self.peer.transport.connected:
11 self.peer.transport.loseWriteConnection()
12
13
14diff --git a/turnip/pack/ssh.py b/turnip/pack/ssh.py
15index b753220..3526bb9 100644
16--- a/turnip/pack/ssh.py
17+++ b/turnip/pack/ssh.py
18@@ -176,7 +176,8 @@ class SmartSSHSession(DoNothingSession):
19 self.pack_protocol.transport.loseConnection()
20
21 def eofReceived(self):
22- if self.pack_protocol is not None:
23+ if (self.pack_protocol is not None and
24+ self.pack_protocol.transport.connected):
25 self.pack_protocol.transport.loseWriteConnection()
26
27

Subscribers

People subscribed via source and target branches