Lines 1794-1799
Link Here
|
1794 |
} |
1794 |
} |
1795 |
#endif |
1795 |
#endif |
1796 |
|
1796 |
|
|
|
1797 |
#if PROXY_HAS_SCOREBOARD |
1798 |
void *ap_proxy_set_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 |
if (worker->s) { |
1809 |
return worker->s; |
1810 |
} |
1811 |
|
1812 |
apr_md5(digest, (const unsigned char *) worker->name, |
1813 |
strlen(worker->name)); |
1814 |
|
1815 |
/* Try to find out the right shared memory according to the hash |
1816 |
* of worker->name. */ |
1817 |
while ((s = (proxy_worker_stat *)ap_get_scoreboard_lb(i++)) != NULL) { |
1818 |
if (memcmp(s->digest, digest, APR_MD5_DIGESTSIZE) == 0) { |
1819 |
worker->s = s; |
1820 |
return s; |
1821 |
} |
1822 |
else if (s->status == 0 && free_slot == NULL) { |
1823 |
free_slot = s; |
1824 |
} |
1825 |
} |
1826 |
|
1827 |
/* We failed to find out shared memory, so just use free slot */ |
1828 |
worker->s = free_slot; |
1829 |
return free_slot; |
1830 |
}; |
1831 |
#endif |
1832 |
|
1797 |
/* |
1833 |
/* |
1798 |
* ap_proxy_initialize_worker_share() concerns itself |
1834 |
* ap_proxy_initialize_worker_share() concerns itself |
1799 |
* with initializing those parts of worker which |
1835 |
* with initializing those parts of worker which |
Lines 1819-1828
Link Here
|
1819 |
#if PROXY_HAS_SCOREBOARD |
1855 |
#if PROXY_HAS_SCOREBOARD |
1820 |
/* Get scoreboard slot */ |
1856 |
/* Get scoreboard slot */ |
1821 |
if (ap_scoreboard_image) { |
1857 |
if (ap_scoreboard_image) { |
1822 |
score = ap_get_scoreboard_lb(worker->id); |
1858 |
score = ap_proxy_set_scoreboard_lb(worker); |
1823 |
if (!score) { |
1859 |
if (!score) { |
1824 |
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, |
1860 |
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", |
1861 |
"proxy: ap_proxy_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s", |
1826 |
worker->id, getpid(), worker->name); |
1862 |
worker->id, getpid(), worker->name); |
1827 |
} |
1863 |
} |
1828 |
else { |
1864 |
else { |
Lines 1863-1868
Link Here
|
1863 |
*worker->s->redirect = '\0'; |
1899 |
*worker->s->redirect = '\0'; |
1864 |
} |
1900 |
} |
1865 |
|
1901 |
|
|
|
1902 |
apr_md5(worker->s->digest, (const unsigned char *) worker->name, |
1903 |
strlen(worker->name)); |
1904 |
|
1866 |
worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED); |
1905 |
worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED); |
1867 |
|
1906 |
|
1868 |
} |
1907 |
} |