aboutsummaryrefslogtreecommitdiff
path: root/fcgi-cgi.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2010-05-07 22:31:29 +0200
committerStefan Bühler <stbuehler@web.de>2010-05-07 22:31:29 +0200
commitb094a9ad168cf3a4eb99f0a73d9b3d720ca93652 (patch)
treeee5ae2c9e5738cd20efd2f1e638ac4404196afd0 /fcgi-cgi.c
parent51ecc24ddbc2a6bed20856df8614ebd4739e2197 (diff)
downloadfcgi-cgi-b094a9ad168cf3a4eb99f0a73d9b3d720ca93652.tar.gz
fcgi-cgi-b094a9ad168cf3a4eb99f0a73d9b3d720ca93652.zip
Reenable accepting connections after hitting the limit (fixes #2195)
Diffstat (limited to 'fcgi-cgi.c')
-rw-r--r--fcgi-cgi.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/fcgi-cgi.c b/fcgi-cgi.c
index 5dd00fd..fc44a7f 100644
--- a/fcgi-cgi.c
+++ b/fcgi-cgi.c
@@ -494,11 +494,11 @@ static const fastcgi_callbacks cgi_callbacks = {
/* cb_reset_connection: */ fcgi_cgi_reset_connection
};
-static fcgi_cgi_server* fcgi_cgi_server_create(struct ev_loop *loop, int fd) {
+static fcgi_cgi_server* fcgi_cgi_server_create(struct ev_loop *loop, int fd, guint maxconns) {
fcgi_cgi_server* srv = g_slice_new0(fcgi_cgi_server);
srv->loop = loop;
srv->aborted_pending_childs = g_ptr_array_new();
- srv->fsrv = fastcgi_server_create(loop, fd, &cgi_callbacks, 10);
+ srv->fsrv = fastcgi_server_create(loop, fd, &cgi_callbacks, maxconns);
srv->fsrv->data = srv;
return srv;
}
@@ -539,6 +539,23 @@ static void sigint_cb(struct ev_loop *loop, struct ev_signal *w, int revents) {
}
}
+typedef struct {
+ gint maxconns;
+
+ gboolean show_version;
+} options;
+
+static options opts = {
+ /* maxconns:*/ 16,
+ /* version: */ FALSE,
+};
+
+static const GOptionEntry entries[] = {
+ { "max-connections", 'c', 0, G_OPTION_ARG_INT, &opts.maxconns, "Maximum number of connections (default 16)", "number" },
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &opts.show_version, "Show version", NULL },
+ { NULL, 0, 0, 0, NULL, NULL, NULL }
+};
+
int main(int argc, char **argv) {
struct ev_loop *loop;
fcgi_cgi_server* srv;
@@ -546,7 +563,7 @@ int main(int argc, char **argv) {
UNUSED(argv);
loop = ev_default_loop(0);
- srv = fcgi_cgi_server_create(loop, 0);
+ srv = fcgi_cgi_server_create(loop, 0, opts.maxconns);
signal(SIGPIPE, SIG_IGN);
CATCH_SIGNAL(loop, sigint_cb, INT);