changeset 46660:0738bc25d6ac

sshpeer: add a method to check if a doublepipe is closed 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). Differential Revision: https://phab.mercurial-scm.org/D9996
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Mon, 15 Feb 2021 14:11:38 -0500
parents 8c4906105f37
children 0509cee38757
files mercurial/sshpeer.py tests/test-check-interfaces.py
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sshpeer.py	Mon Feb 15 13:59:36 2021 -0500
+++ b/mercurial/sshpeer.py	Mon Feb 15 14:11:38 2021 -0500
@@ -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()
 
--- a/tests/test-check-interfaces.py	Mon Feb 15 13:59:36 2021 -0500
+++ b/tests/test-check-interfaces.py	Mon Feb 15 14:11:38 2021 -0500
@@ -113,6 +113,10 @@
     def close(self):
         pass
 
+    @property
+    def closed(self):
+        pass
+
 
 def main():
     ui = uimod.ui()