Blame SOURCES/bz720543-pcmk-ipc_use_the_higher_of_the_configured_buffer_size_or_the_default.patch

ed0026
commit 20845c58bf1003225241dcefb47d7d71013aa432
ed0026
Author: Andrew Beekhof <andrew@beekhof.net>
ed0026
Date:   Fri Oct 18 12:20:29 2013 +1100
ed0026
ed0026
    Fix: ipc: Use the higher of the configured buffer size or the default
ed0026
    
ed0026
    (cherry picked from commit 87a34aa975ae2a114e964e3dd9c3c84a937c1979)
ed0026
ed0026
diff --git a/lib/common/ipc.c b/lib/common/ipc.c
ed0026
index 451bda5..435b392 100644
ed0026
--- a/lib/common/ipc.c
ed0026
+++ b/lib/common/ipc.c
ed0026
@@ -681,22 +681,19 @@ struct crm_ipc_s {
ed0026
 static int
ed0026
 pick_ipc_buffer(int max)
ed0026
 {
ed0026
-    const char *env = getenv("PCMK_ipc_buffer");
ed0026
+    static int global_max = 0;
ed0026
 
ed0026
-    if (env) {
ed0026
-        max = crm_parse_int(env, "0");
ed0026
-    }
ed0026
-
ed0026
-    if (max <= 0) {
ed0026
-        max = MAX_MSG_SIZE;
ed0026
-    }
ed0026
+    if(global_max == 0) {
ed0026
+        const char *env = getenv("PCMK_ipc_buffer");
ed0026
 
ed0026
-    if (max < MIN_MSG_SIZE) {
ed0026
-        max = MIN_MSG_SIZE;
ed0026
+        if (env) {
ed0026
+            global_max = crm_parse_int(env, "0");
ed0026
+        } else {
ed0026
+            global_max = MAX_MSG_SIZE;
ed0026
+        }
ed0026
     }
ed0026
 
ed0026
-    crm_trace("Using max message size of %d", max);
ed0026
-    return max;
ed0026
+    return QB_MAX(max, global_max);
ed0026
 }
ed0026
 
ed0026
 crm_ipc_t *