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 |
unsigned char digest[APR_MD5_DIGESTSIZE]; |
1803 |
|
1804 |
if (!ap_scoreboard_image) { |
1805 |
return NULL; |
1806 |
} |
1807 |
|
1808 |
apr_md5(digest, (const unsigned char *) worker->name, |
1809 |
strlen(worker->name)); |
1810 |
|
1811 |
/* Try to find out the right shared memory according to the hash |
1812 |
* of worker->name. */ |
1813 |
while ((s = (proxy_worker_stat *)ap_get_scoreboard_lb(i++)) != NULL) { |
1814 |
if (memcmp(s->digest, digest, APR_MD5_DIGESTSIZE) == 0) { |
1815 |
return s; |
1816 |
} |
1817 |
else if (s->status == 0 && free_slot == NULL) { |
1818 |
free_slot = s; |
1819 |
} |
1820 |
} |
1821 |
|
1822 |
/* We failed to find out shared memory, so just use free slot */ |
1823 |
return free_slot; |
1824 |
}; |
1825 |
#endif |
1826 |
|
1797 |
/* |
1827 |
/* |
1798 |
* ap_proxy_initialize_worker_share() concerns itself |
1828 |
* ap_proxy_initialize_worker_share() concerns itself |
1799 |
* with initializing those parts of worker which |
1829 |
* with initializing those parts of worker which |
Lines 1819-1828
Link Here
|
1819 |
#if PROXY_HAS_SCOREBOARD |
1849 |
#if PROXY_HAS_SCOREBOARD |
1820 |
/* Get scoreboard slot */ |
1850 |
/* Get scoreboard slot */ |
1821 |
if (ap_scoreboard_image) { |
1851 |
if (ap_scoreboard_image) { |
1822 |
score = ap_get_scoreboard_lb(worker->id); |
1852 |
score = ap_proxy_get_scoreboard_lb(worker); |
1823 |
if (!score) { |
1853 |
if (!score) { |
1824 |
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, |
1854 |
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", |
1855 |
"proxy: ap_proxy_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s", |
1826 |
worker->id, getpid(), worker->name); |
1856 |
worker->id, getpid(), worker->name); |
1827 |
} |
1857 |
} |
1828 |
else { |
1858 |
else { |
Lines 1863-1868
Link Here
|
1863 |
*worker->s->redirect = '\0'; |
1893 |
*worker->s->redirect = '\0'; |
1864 |
} |
1894 |
} |
1865 |
|
1895 |
|
|
|
1896 |
apr_md5(worker->s->digest, (const unsigned char *) worker->name, |
1897 |
strlen(worker->name)); |
1898 |
|
1866 |
worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED); |
1899 |
worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED); |
1867 |
|
1900 |
|
1868 |
} |
1901 |
} |