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