View | Details | Raw Unified | Return to bug 44736
Collapse All | Expand All

(-)modules/proxy/mod_proxy.h (+6 lines)
Lines 292-297 Link Here
292
/* default worker retry timeout in seconds */
292
/* default worker retry timeout in seconds */
293
#define PROXY_WORKER_DEFAULT_RETRY  60
293
#define PROXY_WORKER_DEFAULT_RETRY  60
294
#define PROXY_WORKER_MAX_ROUTE_SIZ  63
294
#define PROXY_WORKER_MAX_ROUTE_SIZ  63
295
#define PROXY_WORKER_MAX_NAME_SIZE  255
295
296
296
/* Runtime worker status informations. Shared in scoreboard */
297
/* Runtime worker status informations. Shared in scoreboard */
297
typedef struct {
298
typedef struct {
Lines 308-313 Link Here
308
    void            *context;   /* general purpose storage */
309
    void            *context;   /* general purpose storage */
309
    apr_size_t      busy;       /* busyness factor */
310
    apr_size_t      busy;       /* busyness factor */
310
    int             lbset;      /* load balancer cluster set */
311
    int             lbset;      /* load balancer cluster set */
312
    char            name[PROXY_WORKER_MAX_NAME_SIZE+1];
311
} proxy_worker_stat;
313
} proxy_worker_stat;
312
314
313
/* Worker configuration */
315
/* Worker configuration */
Lines 772-777 Link Here
772
ap_proxy_buckets_lifetime_transform(request_rec *r, apr_bucket_brigade *from,
774
ap_proxy_buckets_lifetime_transform(request_rec *r, apr_bucket_brigade *from,
773
                                        apr_bucket_brigade *to);
775
                                        apr_bucket_brigade *to);
774
776
777
#if PROXY_HAS_SCOREBOARD
778
void *ap_proxy_get_scoreboard_lb(proxy_worker *worker);
779
#endif
780
775
#define PROXY_LBMETHOD "proxylbmethod"
781
#define PROXY_LBMETHOD "proxylbmethod"
776
782
777
/* The number of dynamic workers that can be added when reconfiguring.
783
/* The number of dynamic workers that can be added when reconfiguring.
(-)modules/proxy/mod_proxy_balancer.c (-1 / +1 lines)
Lines 94-100 Link Here
94
             * If the worker is not initialized check whether its scoreboard
94
             * If the worker is not initialized check whether its scoreboard
95
             * slot is already initialized.
95
             * slot is already initialized.
96
             */
96
             */
97
            slot = (proxy_worker_stat *) ap_get_scoreboard_lb(workers->id);
97
            slot = (proxy_worker_stat *) ap_proxy_get_scoreboard_lb(workers);
98
            if (slot) {
98
            if (slot) {
99
                worker_is_initialized = slot->status & PROXY_WORKER_INITIALIZED;
99
                worker_is_initialized = slot->status & PROXY_WORKER_INITIALIZED;
100
            }
100
            }
(-)modules/proxy/proxy_util.c (-1 / +27 lines)
Lines 1794-1799 Link Here
1794
}
1794
}
1795
#endif
1795
#endif
1796
1796
1797
#if PROXY_HAS_SCOREBOARD
1798
void *ap_proxy_get_scoreboard_lb(proxy_worker *worker) {
1799
    int i = 0;
1800
    proxy_worker_stat *free_slot = NULL;
1801
    proxy_worker_stat *s;
1802
1803
    if (!ap_scoreboard_image) {
1804
        return NULL;
1805
    }
1806
1807
    /* Try to find out the right shared memory according to worker->name. */
1808
    while ((s = (proxy_worker_stat *)ap_get_scoreboard_lb(i++)) != NULL) {
1809
        if (strncmp(worker->name, s->name, PROXY_WORKER_MAX_NAME_SIZE) == 0) {
1810
            return s; 
1811
        }
1812
        else if (s->status == 0 && free_slot == NULL) {
1813
            free_slot = s;
1814
        }
1815
    }
1816
1817
    /* We failed to find out shared memory, so just use free slot */
1818
    return free_slot;
1819
};
1820
#endif
1821
1797
/*
1822
/*
1798
 * ap_proxy_initialize_worker_share() concerns itself
1823
 * ap_proxy_initialize_worker_share() concerns itself
1799
 * with initializing those parts of worker which
1824
 * with initializing those parts of worker which
Lines 1819-1825 Link Here
1819
#if PROXY_HAS_SCOREBOARD
1844
#if PROXY_HAS_SCOREBOARD
1820
        /* Get scoreboard slot */
1845
        /* Get scoreboard slot */
1821
    if (ap_scoreboard_image) {
1846
    if (ap_scoreboard_image) {
1822
        score = ap_get_scoreboard_lb(worker->id);
1847
        score = get_scoreboard_lb(worker);
1823
        if (!score) {
1848
        if (!score) {
1824
            ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
1849
            ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
1825
                  "proxy: ap_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s",
1850
                  "proxy: ap_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s",
Lines 1862-1867 Link Here
1862
    else {
1887
    else {
1863
        *worker->s->redirect = '\0';
1888
        *worker->s->redirect = '\0';
1864
    }
1889
    }
1890
    strncpy(worker->s->name, worker->name, PROXY_WORKER_MAX_NAME_SIZE);
1865
1891
1866
    worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED);
1892
    worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED);
1867
1893

Return to bug 44736