Exemplo n.º 1
0
void Server::read() {
	DEBUGF(bufferevent_read_buffer(buf, evbuf));
	char *ln;
	while((ln = evbuffer_readln(evbuf, NULL, EVBUFFER_EOL_ANY))) {
		parse(ln);
		free(ln);
	}
	return;
}
Exemplo n.º 2
0
static void
readcb(struct bufferevent *bev, void *arg)
{
    if (evbuffer_get_length(bev->input) == 8333) {
        struct evbuffer *evbuf = evbuffer_new();
        assert(evbuf != NULL);

        /* gratuitous test of bufferevent_read_buffer */
        bufferevent_read_buffer(bev, evbuf);

        bufferevent_disable(bev, EV_READ);

        if (evbuffer_get_length(evbuf) == 8333) {
            test_ok++;
        }

        evbuffer_free(evbuf);
    }
}
Exemplo n.º 3
0
static void
wm_readcb(struct bufferevent *bev, void *arg)
{
	struct evbuffer *evbuf = evbuffer_new();
	int len = evbuffer_get_length(bev->input);
	static int nread;

	assert(len >= 10 && len <= 20);

	assert(evbuf != NULL);

	/* gratuitous test of bufferevent_read_buffer */
	bufferevent_read_buffer(bev, evbuf);

	nread += len;
	if (nread == 65000) {
		bufferevent_disable(bev, EV_READ);
		test_ok++;
	}

	evbuffer_free(evbuf);
}