Prevent the secchan from dying due to SIGPIPE.
[openvswitch] / secchan / secchan.c
index e54fb2ff392d0763b2dc33026af7d648c4f863cb..af52ed5eb721d7f5b218080824f80599fe254d58 100644 (file)
@@ -40,6 +40,7 @@
 #include <poll.h>
 #include <regex.h>
 #include <stdlib.h>
+#include <signal.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
@@ -179,6 +180,7 @@ main(int argc, char *argv[])
     time_init();
     vlog_init();
     parse_options(argc, argv, &s);
+    signal(SIGPIPE, SIG_IGN);
 
     /* Start listening for management connections. */
     if (s.listen_vconn_name) {
@@ -1219,13 +1221,10 @@ parse_options(int argc, char *argv[], struct settings *s)
             VLOG_WARN("Rate limit set to unusually low value %d",
                       s->rate_limit);
         }
-
         if (!s->burst_limit) {
-            s->burst_limit = s->rate_limit * 2;
-        } else if (s->burst_limit < s->rate_limit) {
-            VLOG_WARN("Burst limit (%d) set lower than rate limit (%d)",
-                      s->burst_limit, s->rate_limit);
+            s->burst_limit = s->rate_limit / 4;
         }
+        s->burst_limit = MAX(s->burst_limit, 1);
         s->burst_limit = MIN(s->burst_limit, INT_MAX / 1000);
     }
 }