Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
---------------------------------------------------------------
commit 05c0480c427278eafed77eeab4d7d4088fa4b3e5
Author: Peter Hatina <phatina(a)redhat.com>
Date: Fri Dec 6 09:02:25 2013 +0100
fix blocking when receiving indication
---------------------------------------------------------------
cli/lmi/shell/LMIIndicationListener.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/cli/lmi/shell/LMIIndicationListener.py
b/cli/lmi/shell/LMIIndicationListener.py
index cc48b9b..4f70e77 100644
--- a/cli/lmi/shell/LMIIndicationListener.py
+++ b/cli/lmi/shell/LMIIndicationListener.py
@@ -62,7 +62,12 @@ class LMIIndicationHandler(ThreadingMixIn, BaseHTTPRequestHandler):
where the ``indication_name`` is a string, which properly defines the
indication.
"""
- msg = self.rfile.read()
+ # If HTTP/1.1 used, try to get a message body length. If Content-Length header
is
+ # not present, set length to -1; rfile.read() will block, until the connection
is
+ # closed. Knowing the exact content length makes the routine to finish early,
even
+ # if the TCP connection is not closed.
+ length = int(self.headers.get("Content-Length", "-1"))
+ msg = self.rfile.read(length)
tt = pywbem.parse_cim(pywbem.xml_to_tupletree(msg))
message = tt[2]
export_methods = {}