CGI-SpeedyCGI

 view release on metacpan or  search on metacpan

src/speedy_backend.h  view on Meta::CPAN

 */

void speedy_backend_dispose(slotnum_t gslotnum, slotnum_t bslotnum);
slotnum_t speedy_backend_be_wait_get(slotnum_t gslotnum);
void speedy_backend_be_wait_put(slotnum_t gslotnum, slotnum_t bslotnum);
slotnum_t speedy_backend_create_slot(slotnum_t gslotnum);
void speedy_backend_remove_be_wait(slotnum_t gslotnum);
int speedy_backend_below_maxbe(slotnum_t gslotnum);
void speedy_backend_exited(slotnum_t bslotnum, int exit_on_sig, int exit_val);

#define speedy_backend_alive(b) \
	(speedy_util_kill(FILE_SLOT(be_slot, (b)).pid, 0) != -1)

#define speedy_backend_dead(b) (!speedy_backend_alive(b))

/* Backend is dead, simulate sigkill */
#define speedy_backend_died(b) speedy_backend_exited((b),1,SIGKILL)

src/speedy_backend_main.c  view on Meta::CPAN

	if (!(prev = speedy_slot_prev(gslotnum)))
	    prev = FILE_HEAD.group_tail;

	/* Don't check ourself or slot-0 */
	if (!prev || prev == gslotnum)
	    return;

	gslotnum = prev;
    }

    /* Check the group to see if be_parent is alive.  If so, done */
    if (speedy_group_parent_sig(gslotnum, 0))
	return;

    /* Invalidate this group.  This should kill any waiting be's. */
    speedy_group_invalidate(gslotnum);

    /* Check for and clean up any dead bes */
    {
	slotnum_t next, bslotnum;

src/speedy_frontend.c  view on Meta::CPAN

    if (speedy_backend_below_maxbe(gslotnum)) {

	/* Signal the be parent to start a new backend */
	if (speedy_group_start_be(gslotnum)) {
	    /* Let it start one before spawning again */
	    gslot->be_starting = gslot->be_parent;
	    *did_spawn = 1;
	}
    } else {
	/* If we're above the maxbaceknds limit, we still need to ping the
	 * be parent to make sure it's alive.
	 */
	speedy_group_parent_sig(gslotnum, 0);
    }
    return 1;
}

/* Go up the fe list, going to the next group if we're at the
 * begininng of the list.  Wrap to the first group if we go off the end
 * of the group list.  Worst case we wrap around and return ourself.
 */

src/speedy_frontend.h  view on Meta::CPAN

/* For strings shorter than this, use a one-byte string length when sending
 * strings from the frontend to the backend
 */
#define MAX_SHORT_STR 255

/* Bytes that tell the backend how to find the cwd */
#define SPEEDY_CWD_IN_SCRIPT	0	/* Cwd is in path to script */
#define SPEEDY_CWD_DEVINO	1	/* Cwd dev/inode to follow */
#define SPEEDY_CWD_UNKNOWN	2	/* Cwd dev/inode is unknown */

#define speedy_frontend_dead(f) (!speedy_frontend_alive(f))
#define speedy_frontend_alive(f) \
    (speedy_util_kill(FILE_SLOT(fe_slot,(f)).pid, 0) != -1)

src/speedy_main.c  view on Meta::CPAN

		speedy_poll_set(&pi, b->rdfd, SPEEDY_POLLIN);
	    if (speedy_cb_canwrite(b))
		speedy_poll_set(&pi, b->wrfd, SPEEDY_POLLOUT);
	}

	/* Poll... */
	i = speedy_poll_wait(&pi, 5000);
	if (i < 1) {
	    if (i == -1 && errno != EINTR)
		speedy_util_exit(1, 0);
	    /* Want to check whether backend is still alive */
	    if (!backend_exited)
		catch_sig(0);
	    speedy_poll_reset(&pi);
	}
    }

    /* SGI's /dev/tty goes crazy unless we turn on blocking I/O. */
    for (i = 0; i < NUMFDS; ++i)
	fd_change(i, FD_BLOCK);



( run in 1.061 second using v1.01-cache-2.11-cpan-df04353d9ac )