[openlmi-tools/f20] fix blocking timeout when receiving indication

Peter Hatina phatina at fedoraproject.org
Fri Dec 6 13:14:12 UTC 2013


commit dba6278107aba6ebd61f68f73d3429abfabc8fae
Author: Peter Hatina <phatina at redhat.com>
Date:   Fri Dec 6 14:10:38 2013 +0100

    fix blocking timeout when receiving indication

 ...09-fix-blocking-when-receiving-indication.patch |   32 ++++++++++++++++++++
 openlmi-tools.spec                                 |    7 ++++-
 2 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/openlmi-tools-09-fix-blocking-when-receiving-indication.patch b/openlmi-tools-09-fix-blocking-when-receiving-indication.patch
new file mode 100644
index 0000000..de737af
--- /dev/null
+++ b/openlmi-tools-09-fix-blocking-when-receiving-indication.patch
@@ -0,0 +1,32 @@
+From 05c0480c427278eafed77eeab4d7d4088fa4b3e5 Mon Sep 17 00:00:00 2001
+From: Peter Hatina <phatina at redhat.com>
+Date: Fri, 6 Dec 2013 09:02:25 +0100
+Subject: [PATCH 1/2] fix blocking when receiving indication
+
+---
+ cli/lmi/shell/LMIIndicationListener.py | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+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 = {}
+-- 
+Peter Hatina
+ENG Server Experience, System Management
+Red Hat Czech, Brno
+
diff --git a/openlmi-tools.spec b/openlmi-tools.spec
index 79d5423..afc318e 100644
--- a/openlmi-tools.spec
+++ b/openlmi-tools.spec
@@ -1,6 +1,6 @@
 Name:           openlmi-tools
 Version:        0.9
-Release:        9%{?dist}
+Release:        10%{?dist}
 Summary:        Set of CLI tools for Openlmi providers
 
 License:        GPLv2+
@@ -14,6 +14,7 @@ Patch4:         openlmi-tools-05-fix-log-messages-connect.patch
 Patch5:         openlmi-tools-06-fix-unify-lmishell-naming.patch
 Patch6:         openlmi-tools-07-fix-interactive-connect.patch
 Patch7:         openlmi-tools-08-fix-compulsory-call-order-listener.patch
+Patch8:         openlmi-tools-09-fix-blocking-when-receiving-indication.patch
 BuildArch:      noarch
 
 BuildRequires:  automake
@@ -49,6 +50,7 @@ Summary:        Documentation for %{name}
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 
 %build
 pushd cli
@@ -100,6 +102,9 @@ install -m 644 cli/completion/_lmishell $zsh_comp_dir
 %{_docdir}/%{name}-%{version}/html
 
 %changelog
+* Fri Dec  6 2013 Peter Hatina <phatina at redhat.com> - 0.9-10
+- fix blocking timeout when receiving indication
+
 * Wed Dec  4 2013 Peter Hatina <phatina at redhat.com> - 0.9-9
 - fix compulsory call order of LMIIndicationListener methods
 


More information about the scm-commits mailing list