Changeset 1500
- Timestamp:
- 01/03/2007 09:46:32 AM (20 months ago)
- Location:
- branches/lighttpd-1.4.x/src
- Files:
-
- 2 modified
-
mod_fastcgi.c (modified) (5 diffs)
-
mod_proxy.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/lighttpd-1.4.x/src/mod_fastcgi.c
r1371 r1500 276 276 277 277 int note_is_sent; 278 int last_used_ndx; 278 279 279 280 fcgi_extension_host **hosts; … … 564 565 assert(fe); 565 566 fe->key = buffer_init(); 567 fe->last_used_ndx = -1; 566 568 buffer_copy_string_buffer(fe->key, key); 567 569 … … 2382 2384 /* append to read-buffer */ 2383 2385 if (-1 == (r = read(hctx->fd, b->ptr, toread))) { 2386 if (errno == EAGAIN) return 0; 2384 2387 log_error_write(srv, __FILE__, __LINE__, "sds", 2385 2388 "unexpected end-of-file (perhaps the fastcgi process died):", … … 2980 2983 int ndx, used = -1; 2981 2984 2982 /* get best server */ 2983 for (k = 0, ndx = -1; k < hctx->ext->used; k++) { 2984 host = hctx->ext->hosts[k]; 2985 2986 /* we should have at least one proc that can do something */ 2987 if (host->active_procs == 0) continue; 2988 2989 if (used == -1 || host->load < used) { 2990 used = host->load; 2991 2992 ndx = k; 2985 /* check if the next server has no load. */ 2986 ndx = hctx->ext->last_used_ndx + 1; 2987 if(ndx >= hctx->ext->used || ndx < 0) ndx = 0; 2988 host = hctx->ext->hosts[ndx]; 2989 if (host->load > 0) { 2990 /* get backend with the least load. */ 2991 for (k = 0, ndx = -1; k < hctx->ext->used; k++) { 2992 host = hctx->ext->hosts[k]; 2993 2994 /* we should have at least one proc that can do something */ 2995 if (host->active_procs == 0) continue; 2996 2997 if (used == -1 || host->load < used) { 2998 used = host->load; 2999 3000 ndx = k; 3001 } 2993 3002 } 2994 3003 } … … 3006 3015 } 3007 3016 3017 hctx->ext->last_used_ndx = ndx; 3008 3018 host = hctx->ext->hosts[ndx]; 3009 3019 -
branches/lighttpd-1.4.x/src/mod_proxy.c
r1371 r1500 657 657 658 658 if (-1 == (r = read(hctx->fd, hctx->response->ptr + hctx->response->used - 1, b))) { 659 if (errno == EAGAIN) return 0; 659 660 log_error_write(srv, __FILE__, __LINE__, "sds", 660 661 "unexpected end-of-file (perhaps the proxy process died):",

