Lines Matching defs:worker
32 proxy_worker *worker, server_rec *s) = NULL;
119 proxy_worker *worker = *workers;
122 ap_proxy_worker_name(p, worker));
123 worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(worker);
125 ap_proxy_initialize_worker(worker, s, p);
202 /* Find the worker that has the 'route' defined
217 proxy_worker *worker = *workers;
218 if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
220 if (*(worker->s->route) && strcmp(worker->s->route, route) == 0) {
221 if (PROXY_WORKER_IS_USABLE(worker)) {
222 return worker;
225 * If the worker is in error state run
226 * retry on that worker. It will be marked as
228 * The worker might still be unusable, but we try
231 ap_proxy_retry_worker_fn("BALANCER", worker, r->server);
232 if (PROXY_WORKER_IS_USABLE(worker)) {
233 return worker;
236 * We have a worker that is unusable.
238 * it has a redirection set use that redirection worker.
243 if (*worker->s->redirect) {
245 rworker = find_route_worker(balancer, worker->s->redirect, r);
246 /* Check if the redirect worker is usable */
249 * If the worker is in error state run
250 * retry on that worker. It will be marked as
252 * The worker might still be unusable, but we try
275 proxy_worker *worker = NULL;
306 * Find the worker that has this route defined.
308 worker = find_route_worker(balancer, *route, r);
309 if (worker && strcmp(*route, worker->s->route)) {
311 * Notice that the route of the worker chosen is different from
317 *route, worker->s->route);
319 return worker;
352 * and try again to find the worker. The chances are
386 static int rewrite_url(request_rec *r, proxy_worker *worker,
396 if (!worker) {
398 "missing worker. URI cannot be parsed: ", *url,
402 *url = apr_pstrcat(r->pool, worker->s->name, path, NULL);
411 proxy_worker **worker;
413 worker = (proxy_worker **)balancer->workers->elts;
414 for (i = 0; i < balancer->workers->nelts; i++, worker++) {
415 if (!((*worker)->s->status & PROXY_WORKER_IN_ERROR)) {
421 ap_proxy_retry_worker_fn("BALANCER", *worker, s);
422 if (!((*worker)->s->status & PROXY_WORKER_IN_ERROR)) {
431 worker = (proxy_worker **)balancer->workers->elts;
432 for (i = 0; i < balancer->workers->nelts; i++, worker++) {
433 ++(*worker)->s->retries;
434 (*worker)->s->status &= ~PROXY_WORKER_IN_ERROR;
436 "%s: Forcing recovery for worker (%s)",
437 balancer->s->name, (*worker)->s->hostname);
444 proxy_worker *worker = worker_;
446 if (worker->s->busy) {
447 worker->s->busy--;
453 static int proxy_balancer_pre_request(proxy_worker **worker,
464 *worker = NULL;
520 *worker = runtime;
556 if (!*worker) {
576 * state, but we have found another working worker for this
582 *worker = runtime;
585 (*worker)->s->busy++;
586 apr_pool_cleanup_register(r->pool, *worker, decrement_busy_count,
589 /* Add balancer/worker info to env. */
593 "BALANCER_WORKER_NAME", (*worker)->s->name);
595 "BALANCER_WORKER_ROUTE", (*worker)->s->route);
600 * real hostname of the elected worker.
602 access_status = rewrite_url(r, *worker, url);
615 "%s: worker (%s) rewritten to %s",
616 (*balancer)->s->name, (*worker)->s->name, *url);
621 static int proxy_balancer_post_request(proxy_worker *worker,
637 && !(worker->s->status & PROXY_WORKER_IGNORE_ERRORS)) {
643 "%s: Forcing worker (%s) into error state "
646 balancer->s->name, ap_proxy_worker_name(r->pool, worker),
648 worker->s->status |= PROXY_WORKER_IN_ERROR;
649 worker->s->error_time = apr_time_now();
656 && !(worker->s->status & PROXY_WORKER_IGNORE_ERRORS)
659 "%s: Forcing worker (%s) into error state "
661 balancer->s->name, ap_proxy_worker_name(r->pool, worker));
662 worker->s->status |= PROXY_WORKER_IN_ERROR;
663 worker->s->error_time = apr_time_now();
685 /* Special case if there is only one worker its
812 proxy_worker *worker;
871 ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(01185) "worker slotmem_create failed");
880 /* now go thru each worker */
885 worker = *workers;
887 shm = ap_proxy_find_workershm(storage, balancer->wslot, worker, &index);
890 ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(02409) "worker slotmem_fgrab failed");
896 ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(01186) "worker slotmem_grab failed");
901 ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(01187) "worker slotmem_dptr failed");
905 if ((rv = ap_proxy_share_worker(worker, shm, index)) != APR_SUCCESS) {
906 ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(01188) "Cannot share worker");
909 worker->s->updated = tstamp;
975 * The balancer, worker and nonce are obtained from
980 * /.../<whatever>/balancer/worker/nonce
987 proxy_worker *worker, *wsel = NULL;
1076 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01192) "settings worker params");
1182 "%s: Lock failed for adding worker",
1192 "worker slotmem_grab failed");
1195 "%s: Unlock failed for adding worker",
1202 "worker slotmem_dptr failed");
1205 "%s: Unlock failed for adding worker",
1212 "Cannot share worker");
1215 "%s: Unlock failed for adding worker",
1222 "Cannot init worker");
1225 "%s: Unlock failed for adding worker",
1237 "%s: Unlock failed for adding worker",
1286 worker = *workers;
1288 ap_rputs(" <httpd:worker>\n", r);
1289 ap_rvputs(r, " <httpd:name>", ap_proxy_worker_name(r->pool, worker),
1291 ap_rvputs(r, " <httpd:scheme>", worker->s->scheme,
1293 ap_rvputs(r, " <httpd:hostname>", worker->s->hostname,
1296 worker->s->lbfactor);
1299 worker->s->port);
1301 worker->s->min);
1303 worker->s->smax);
1305 worker->s->hmax);
1308 apr_time_sec(worker->s->ttl));
1309 if (worker->s->timeout_set) {
1312 apr_time_sec(worker->s->timeout));
1314 if (worker->s->acquire_set) {
1317 apr_time_msec(worker->s->acquire));
1319 if (worker->s->recv_buffer_size_set) {
1322 worker->s->recv_buffer_size);
1324 if (worker->s->io_buffer_size_set) {
1327 worker->s->io_buffer_size);
1329 if (worker->s->keepalive_set) {
1332 (worker->s->keepalive ? "On" : "Off"));
1336 if (worker->s->status & PROXY_WORKER_DISABLED)
1338 else if (worker->s->status & PROXY_WORKER_IN_ERROR)
1340 else if (worker->s->status & PROXY_WORKER_STOPPED)
1342 else if (worker->s->status & PROXY_WORKER_HOT_STANDBY)
1344 else if (PROXY_WORKER_IS_USABLE(worker))
1346 else if (!PROXY_WORKER_IS_INITIALIZED(worker))
1349 if ((worker->s->error_time > 0) && apr_rfc822_date(date, worker->s->error_time) == APR_SUCCESS) {
1355 worker->s->retries);
1358 worker->s->lbstatus);
1361 worker->s->lbfactor);
1364 worker->s->transferred);
1367 worker->s->read);
1370 worker->s->elected);
1372 ap_escape_html(r->pool, worker->s->route),
1375 ap_escape_html(r->pool, worker->s->redirect),
1379 worker->s->busy);
1381 worker->s->lbset);
1383 if (!strcasecmp(worker->s->scheme, "ajp")) {
1385 switch (worker->s->flush_packets) {
1397 if (worker->s->flush_packets == flush_auto) {
1400 worker->s->flush_wait);
1402 if (worker->s->ping_timeout_set) {
1405 apr_time_msec(worker->s->ping_timeout));
1408 if (worker->s->disablereuse_set) {
1411 (worker->s->disablereuse ? "On" : "Off"));
1413 if (worker->s->conn_timeout_set) {
1416 apr_time_msec(worker->s->conn_timeout));
1418 if (worker->s->retry_set) {
1421 apr_time_sec(worker->s->retry));
1423 ap_rputs(" </httpd:worker>\n", r);
1531 worker = *workers;
1535 ap_escape_uri(r->pool, worker->s->name),
1538 ap_rvputs(r, (*worker->s->uds_path ? "<i>" : ""), ap_proxy_worker_name(r->pool, worker),
1539 (*worker->s->uds_path ? "</i>" : ""), "</a></td>", NULL);
1540 ap_rvputs(r, "<td>", ap_escape_html(r->pool, worker->s->route),
1543 ap_escape_html(r->pool, worker->s->redirect), NULL);
1544 ap_rprintf(r, "</td><td>%d</td>", worker->s->lbfactor);
1545 ap_rprintf(r, "<td>%d</td><td>", worker->s->lbset);
1546 ap_rvputs(r, ap_proxy_parse_wstatus(r->pool, worker), NULL);
1548 ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td>", worker->s->elected);
1549 ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td>", worker->s->busy);
1550 ap_rprintf(r, "<td>%d</td><td>", worker->s->lbstatus);
1551 ap_rputs(apr_strfsize(worker->s->transferred, fbuf), r);
1553 ap_rputs(apr_strfsize(worker->s->read, fbuf), r);
1563 ap_rputs("<h3>Edit worker settings for ", r);