From 703d6b44e67b5b9c7494d29142f6b76b758a05cd Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 13 Jan 2016 15:36:49 +0000
Subject: [PATCH] Task #8888: Added open() and close() to RPC class to hide
 implementation details of __enter__ and __exit__

---
 LCS/Messaging/python/messaging/RPC.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/LCS/Messaging/python/messaging/RPC.py b/LCS/Messaging/python/messaging/RPC.py
index 78556a45e08..5edf3daa626 100644
--- a/LCS/Messaging/python/messaging/RPC.py
+++ b/LCS/Messaging/python/messaging/RPC.py
@@ -93,18 +93,32 @@ class RPC():
         if len(kwargs):
             raise AttributeError("Unexpected argument passed to RPC class: %s" %( kwargs ))
 
+    def open(self):
+        """
+        Start accepting requests.
+        """
+
+        self.Request.open()
+
+    def close(self):
+        """
+        Stop accepting requests.
+        """
+
+        self.Request.close()
+
     def __enter__(self):
         """
         Internal use only. (handles scope 'with')
         """
-        self.Request.open()
+        self.open()
         return self
 
     def __exit__(self, exc_type, exc_val, exc_tb):
         """
         Internal use only. (handles scope 'with')
         """
-        self.Request.close()
+        self.close()
 
     def __call__(self, *args, **kwargs):
         """
-- 
GitLab