//an isdefer func quoted by clientReadDefer static int isDeferReadRequestForHelper(void * data) { helper * hlp = data; if (NULL != hlp) { static time_t last_warn = 0; helper_server * srv = GetFirstAvailable(hlp); if (NULL == srv) { if (hlp->last_queue_warn != 0 && squid_curtime - hlp->last_queue_warn >= 30 ) { if (hlp->stats.queue_size >= 2*hlp->n_running) { if (last_warn + 15 < squid_curtime) { debug(147, 1) ("WARNING! Helper's queue will overflow and reading requests is defered (%d on %d)\n", hlp->stats.queue_size, hlp->n_running); last_warn = squid_curtime; } return 1; } } } } return 0; }
static void helperKickQueue(helper * hlp) { helper_request *r; helper_server *srv; while ((srv = GetFirstAvailable(hlp)) && (r = Dequeue(hlp))) helperDispatch(srv, r); }
void helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data) { helper_request *r = memAllocate(MEM_HELPER_REQUEST); helper_server *srv; if (hlp == NULL) { debug(84, 3) ("helperSubmit: hlp == NULL\n"); callback(data, NULL); return; } r->callback = callback; r->data = data; r->buf = xstrdup(buf); cbdataLock(r->data); if ((srv = GetFirstAvailable(hlp))) helperDispatch(srv, r); else Enqueue(hlp, r); debug(84, 9) ("helperSubmit: %s\n", buf); }