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
diff --git a/turnip/pack/git.py b/turnip/pack/git.py
index c18742f..d45e1db 100644
--- a/turnip/pack/git.py
+++ b/turnip/pack/git.py
@@ -381,7 +381,7 @@ class PackProxyServerProtocol(PackServerProtocol):
381381
382 def readConnectionLost(self):382 def readConnectionLost(self):
383 # Forward the closed stdin down the stack.383 # Forward the closed stdin down the stack.
384 if self.peer is not None:384 if self.peer is not None and self.peer.transport.connected:
385 self.peer.transport.loseWriteConnection()385 self.peer.transport.loseWriteConnection()
386386
387387
diff --git a/turnip/pack/ssh.py b/turnip/pack/ssh.py
index b753220..3526bb9 100644
--- a/turnip/pack/ssh.py
+++ b/turnip/pack/ssh.py
@@ -176,7 +176,8 @@ class SmartSSHSession(DoNothingSession):
176 self.pack_protocol.transport.loseConnection()176 self.pack_protocol.transport.loseConnection()
177177
178 def eofReceived(self):178 def eofReceived(self):
179 if self.pack_protocol is not None:179 if (self.pack_protocol is not None and
180 self.pack_protocol.transport.connected):
180 self.pack_protocol.transport.loseWriteConnection()181 self.pack_protocol.transport.loseWriteConnection()
181182
182183

Subscribers

People subscribed via source and target branches