Patchwork D9996: sshpeer: add a method to check if a doublepipe is closed

login
register
mail settings
Submitter phabricator
Date Feb. 15, 2021, 9:42 p.m.
Message ID <differential-rev-PHID-DREV-i4ltibmjh7ejg2ytjzk4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48312/
State New
Headers show

Comments

phabricator - Feb. 15, 2021, 9:42 p.m.
valentin.gatienbaron created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  So we can tell in a next commit if we're trying to close an already
  closed connection or not (in which case, we may warn).

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9996

AFFECTED FILES
  mercurial/sshpeer.py
  tests/test-check-interfaces.py

CHANGE DETAILS




To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py
--- a/tests/test-check-interfaces.py
+++ b/tests/test-check-interfaces.py
@@ -113,6 +113,10 @@ 
     def close(self):
         pass
 
+    @property
+    def closed(self):
+        pass
+
 
 def main():
     ui = uimod.ui()
diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -140,6 +140,10 @@ 
     def close(self):
         return self._main.close()
 
+    @property
+    def closed(self):
+        return self._main.closed
+
     def flush(self):
         return self._main.flush()