Changeset 2173

Show
Ignore:
Timestamp:
05/22/2008 03:41:17 AM (3 months ago)
Author:
moo
Message:

sync code between fastcgi->scgi: copy note_is_sent, fix typos

Location:
branches/lighttpd-1.4.x/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.4.x/src/mod_fastcgi.c

    r2163 r2173  
    35043504        /* check if we have at least one server for this extension up and running */ 
    35053505        for (k = 0; k < extension->used; k++) { 
    3506                 host = extension->hosts[k]; 
     3506                fcgi_extension_host *h = extension->hosts[k]; 
    35073507 
    35083508                /* we should have at least one proc that can do something */ 
    3509                 if (host->active_procs == 0) { 
    3510                         host = NULL; 
    3511  
     3509                if (h->active_procs == 0) { 
    35123510                        continue; 
    35133511                } 
    35143512 
    35153513                /* we found one host that is alive */ 
     3514                host = h; 
    35163515                break; 
    35173516        } 
  • branches/lighttpd-1.4.x/src/mod_scgi.c

    r2172 r2173  
    234234        buffer *key; /* like .php */ 
    235235 
     236        int note_is_sent; 
    236237        scgi_extension_host **hosts; 
    237238 
     
    26692670        size_t s_len; 
    26702671        int used = -1; 
    2671         int ndx; 
    26722672        size_t k; 
    26732673        buffer *fn; 
     
    27142714 
    27152715        /* get best server */ 
    2716         for (k = 0, ndx = -1; k < extension->used; k++) { 
    2717                 scgi_extension_host *host = extension->hosts[k]; 
    2718  
    2719                 /* we should have at least one proc that can do somthing */ 
    2720                 if (host->active_procs == 0) continue; 
    2721  
    2722                 if (used == -1 || host->load < used) { 
    2723                         used = host->load; 
    2724  
    2725                         ndx = k; 
    2726                 } 
    2727         } 
    2728  
    2729         /* found a server */ 
    2730         if (ndx == -1) { 
    2731                 /* no handler found */ 
     2716        for (k = 0; k < extension->used; k++) { 
     2717                scgi_extension_host *h = extension->hosts[k]; 
     2718 
     2719                /* we should have at least one proc that can do something */ 
     2720                if (h->active_procs == 0) { 
     2721                        continue; 
     2722                } 
     2723 
     2724                if (used == -1 || h->load < used) { 
     2725                        used = h->load; 
     2726 
     2727                        host = h; 
     2728                } 
     2729        } 
     2730 
     2731        if (!host) { 
     2732                /* sorry, we don't have a server alive for this ext */ 
    27322733                buffer_reset(con->physical.path); 
    27332734                con->http_status = 500; 
    27342735 
    2735                 log_error_write(srv, __FILE__, __LINE__,  "sb", 
    2736                                 "no fcgi-handler found for:", 
    2737                                 fn); 
     2736                /* only send the 'no handler' once */ 
     2737                if (!extension->note_is_sent) { 
     2738                        extension->note_is_sent = 1; 
     2739 
     2740                        log_error_write(srv, __FILE__, __LINE__, "sbsbs", 
     2741                                        "all handlers for ", con->uri.path, 
     2742                                        "on", extension->key, 
     2743                                        "are down."); 
     2744                } 
    27382745 
    27392746                return HANDLER_FINISHED; 
    27402747        } 
    27412748 
    2742         host = extension->hosts[ndx]; 
     2749        /* a note about no handler is not sent yet */ 
     2750        extension->note_is_sent = 0; 
    27432751 
    27442752        /* 
     
    27702778 
    27712779                        if (con->conf.log_request_handling) { 
    2772                                 log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_scgi"); 
     2780                                log_error_write(srv, __FILE__, __LINE__, "s", 
     2781                                "handling it in mod_fastcgi"); 
    27732782                        } 
    27742783 
    27752784                        /* the prefix is the SCRIPT_NAME, 
    2776                          * everthing from start to the next slash 
     2785                         * everything from start to the next slash 
    27772786                         * this is important for check-local = "disable" 
    27782787                         * 
     
    28052814                        } 
    28062815                } 
    2807                 return HANDLER_GO_ON; 
    28082816        } else { 
    28092817                handler_ctx *hctx; 
     
    28272835                        log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi"); 
    28282836                } 
    2829  
    2830                 return HANDLER_GO_ON; 
    2831         } 
     2837        } 
     2838 
    28322839        return HANDLER_GO_ON; 
    28332840}