summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2006-02-14 23:51:52 +0000
committerJan Kneschke <jan@kneschke.de>2006-02-14 23:51:52 +0000
commitde0bace2eff635ddc6b087a601d2eccb27a3a50e (patch)
tree5a3c97aefc2af47cef1a8d2f984bb242f55aeb29
parentcdc4c4cc8fb47cb17a39f0c2d99360fd7bf1d5c4 (diff)
downloadlighttpd-git-de0bace2eff635ddc6b087a601d2eccb27a3a50e.tar.gz
- decrement proc-load if we really incremented it
- added host.load as status-variable git-svn-id: svn+ssh://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@997 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--src/mod_fastcgi.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c
index 36c074c9..eddad316 100644
--- a/src/mod_fastcgi.c
+++ b/src/mod_fastcgi.c
@@ -406,8 +406,10 @@ int status_counter_set(server *srv, const char *s, size_t len, int val) {
int fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
buffer_copy_string(b, "fastcgi.backend.");
buffer_append_string_buffer(b, host->id);
- buffer_append_string(b, ".");
- buffer_append_long(b, proc->id);
+ if (proc) {
+ buffer_append_string(b, ".");
+ buffer_append_long(b, proc->id);
+ }
return 0;
}
@@ -426,6 +428,15 @@ int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_
#undef CLEAN
+#define CLEAN(x) \
+ fastcgi_status_copy_procname(b, host, NULL); \
+ buffer_append_string(b, x); \
+ status_counter_set(srv, CONST_BUF_LEN(b), 0);
+
+ CLEAN(".load");
+
+#undef CLEAN
+
return 0;
}
@@ -872,7 +883,8 @@ static int fcgi_spawn_connection(server *srv,
pid_t child;
int val;
- if (!buffer_is_empty(proc->socket)) {
+ if (errno != ENOENT &&
+ !buffer_is_empty(proc->socket)) {
unlink(proc->socket->ptr);
}
@@ -1535,7 +1547,7 @@ static int fcgi_reconnect(server *srv, handler_ctx *hctx) {
hctx->proc->pid, hctx->proc->socket);
}
- if (hctx->proc) {
+ if (hctx->proc && hctx->got_proc) {
hctx->proc->load--;
fcgi_proclist_sort_down(srv, hctx->host, hctx->proc);
}
@@ -2919,11 +2931,18 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) {
status_counter_inc(srv, CONST_BUF_LEN(p->statuskey));
+ /* the proc-load */
fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
buffer_append_string(p->statuskey, ".load");
status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->proc->load);
+ /* the host-load */
+ fastcgi_status_copy_procname(p->statuskey, hctx->host, NULL);
+ buffer_append_string(p->statuskey, ".load");
+
+ status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->host->load);
+
if (p->conf.debug) {
log_error_write(srv, __FILE__, __LINE__, "sddbdd",
"got proc:",