]> granicus.if.org Git - pgbouncer/commitdiff
Make listen(2) backlog argument configurable.
authorMarko Kreen <markokr@gmail.com>
Wed, 21 Apr 2010 10:08:57 +0000 (10:08 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 21 Apr 2010 10:08:57 +0000 (10:08 +0000)
doc/config.txt
etc/pgbouncer.ini
include/bouncer.h
src/main.c
src/pooler.c

index f6aee6bff9dbba102396879d9a4f5b75d6e03dc5..de608173c58209ab33a199b9f4ccf4b0022029d9 100644 (file)
@@ -341,6 +341,13 @@ large.
 
 Default: 2048
 
+==== listen_backlog ====
+
+Backlog argument for listen(2).  Determines how many new unanswered connection
+attempts are kept in queue.  When queue is full, futher new connections are dropped.
+
+Default: 128
+
 ==== sbuf_loopcnt ====
 
 How many times to process data on one connection, before proceeding.
index 685f1cf61c38f4f1cffc861e4428b1314a5d8c02..874b639e7b902810ba47f89c0d71ec76b91b4f68 100644 (file)
@@ -162,6 +162,9 @@ log_pooler_errors = 1
 ;; buffer for streaming packets
 ;pkt_buf = 2048
 
+;; man 2 listen
+;listen_backlog = 128
+
 ;; networking options, for info: man 7 tcp
 
 ;; linux: notify program about new connection only if there
index 44a5123be51ad9d7dac8480cf29aec75d0b7f33f..02c621a54b99afcd5c85f2c1982a9edacab27437 100644 (file)
@@ -310,6 +310,7 @@ extern char *cf_syslog_facility;
 extern char *cf_unix_socket_dir;
 extern char *cf_listen_addr;
 extern int cf_listen_port;
+extern int cf_listen_backlog;
 
 extern int cf_pool_mode;
 extern int cf_max_client_conn;
index 33668bc145fce99375207122a2191530ffb3228e..bbfdb7b6b4d8ed840b9c548ae8a22279eb771291 100644 (file)
@@ -64,6 +64,7 @@ char *cf_config_file = "";
 
 char *cf_listen_addr = NULL;
 int cf_listen_port = 6432;
+int cf_listen_backlog = 128;
 #ifndef WIN32
 char *cf_unix_socket_dir = "/tmp";
 #else
@@ -142,6 +143,7 @@ ConfElem bouncer_params[] = {
 {"pidfile",            false, CF_STR, &cf_pidfile},
 {"listen_addr",                false, CF_STR, &cf_listen_addr},
 {"listen_port",                false, CF_INT, &cf_listen_port},
+{"listen_backlog",     false, CF_INT, &cf_listen_backlog},
 #ifndef WIN32
 {"unix_socket_dir",    false, CF_STR, &cf_unix_socket_dir},
 #endif
index c13c95583874b691fc03b4f8575b2ba06b3ea80b..760e3bf3f4ff917eda51760827a8b12657c31b96 100644 (file)
@@ -194,7 +194,7 @@ static int create_net_socket(const char *listen_addr, int listen_port)
        tune_socket(sock, false);
 
        /* make it accept connections */
-       res = listen(sock, 100);
+       res = listen(sock, cf_listen_backlog);
        if (res < 0)
                fatal_perror("listen");