Patchwork [3,of,4] sshpeer: allow doublepipe on unbuffered main pipe

login
register
mail settings
Submitter Pierre-Yves David
Date June 5, 2015, 6:19 p.m.
Message ID <326294c728893275d7f4.1433528355@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9523/
State Accepted
Headers show

Comments

Pierre-Yves David - June 5, 2015, 6:19 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1433505263 25200
#      Fri Jun 05 04:54:23 2015 -0700
# Node ID 326294c728893275d7f40e3179f45ac0c1a888df
# Parent  b47406fc7d16c72606a95712a8e84c47848874ac
sshpeer: allow doublepipe on unbuffered main pipe

The output pipe does not have manually managed read buffer (actually, no read
anything). To also use the doublepipe for outgoing write (useful to consume
remote output when pushing large set of data) we need the doublepipe to work on
standard pipe too.

Patch

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -63,11 +63,11 @@  class doublepipe(object):
 
         return a pair of boolean (ismainready, issideready)
 
         (This will only wait for data if the setup is supported by `util.poll`)
         """
-        if self._main.hasbuffer:
+        if getattr(self._main, 'hasbuffer', False): # getattr for classic pipe
             return (True, True) # main has data, assume side is worth poking at.
         fds = [self._main.fileno(), self._side.fileno()]
         try:
             act = util.poll(fds)
         except NotImplementedError: