evbuffer_cb_suspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb)
{
if (!(cb->flags & EVBUFFER_CB_SUSPENDED)) {
- cb->size_before_suspend = EVBUFFER_LENGTH(buffer);
+ cb->size_before_suspend = evbuffer_get_length(buffer);
cb->flags |= EVBUFFER_CB_SUSPENDED;
}
}
EVBUFFER_CB_CALL_ON_UNSUSPEND);
cb->size_before_suspend = 0;
if (call && (cb->flags & EVBUFFER_CB_ENABLED)) {
- cb->cb(buffer, sz, EVBUFFER_LENGTH(buffer), cb->cbarg);
+ cb->cb(buffer, sz, evbuffer_get_length(buffer), cb->cbarg);
}
}
}
bufev_private->read_watermarks_cb,
EVBUFFER_CB_ENABLED);
- if (EVBUFFER_LENGTH(bufev->input) > highmark)
+ if (evbuffer_get_length(bufev->input) > highmark)
bufferevent_wm_suspend_read(bufev);
- else if (EVBUFFER_LENGTH(bufev->input) < highmark)
+ else if (evbuffer_get_length(bufev->input) < highmark)
bufferevent_wm_unsuspend_read(bufev);
} else {
/* There is now no high-water mark for read. */
struct bufferevent *u = bevf->underlying;
return state == BEV_NORMAL &&
u->wm_write.high &&
- EVBUFFER_LENGTH(u->output) >= u->wm_write.high;
+ evbuffer_get_length(u->output) >= u->wm_write.high;
}
/** Return 1 if our input buffer is at or over its high watermark such that we
struct bufferevent *bufev = downcast(bevf);
return state == BEV_NORMAL &&
bufev->wm_read.high &&
- EVBUFFER_LENGTH(bufev->input) >= bufev->wm_read.high;
+ evbuffer_get_length(bufev->input) >= bufev->wm_read.high;
}
ssize_t limit = -1;
if (state == BEV_NORMAL && bev->wm_read.high)
limit = bev->wm_read.high -
- EVBUFFER_LENGTH(bev->input);
+ evbuffer_get_length(bev->input);
res = bevf->process_in(bevf->underlying->input,
bev->input, limit, state, bevf->context);
*processed_out = 1;
} while (res == BEV_OK &&
(bev->enabled & EV_READ) &&
- EVBUFFER_LENGTH(bevf->underlying->input) &&
+ evbuffer_get_length(bevf->underlying->input) &&
!be_readbuf_full(bevf, state));
return res;
* call the filter no matter what. */
if (!(bufev->enabled & EV_WRITE) ||
be_underlying_writebuf_full(bevf, state) ||
- !EVBUFFER_LENGTH(bufev->output))
+ !evbuffer_get_length(bufev->output))
return BEV_OK;
}
if (state == BEV_NORMAL &&
bevf->underlying->wm_write.high)
limit = bevf->underlying->wm_write.high -
- EVBUFFER_LENGTH(bevf->underlying->output);
+ evbuffer_get_length(bevf->underlying->output);
res = bevf->process_out(downcast(bevf)->output,
bevf->underlying->output,
(bufev->enabled & EV_WRITE) &&
/* Of if we have nothing more to write and we are
* not flushing. */
- EVBUFFER_LENGTH(bufev->output) &&
+ evbuffer_get_length(bufev->output) &&
/* Or if we have filled the underlying output buffer. */
!be_underlying_writebuf_full(bevf,state));
if (processed && bufev->writecb &&
- EVBUFFER_LENGTH(bufev->output) <= bufev->wm_write.low) {
+ evbuffer_get_length(bufev->output) <= bufev->wm_write.low) {
/* call the write callback.*/
(*bufev->writecb)(bufev, bufev->cbarg);
if (res == BEV_OK &&
(bufev->enabled & EV_WRITE) &&
- EVBUFFER_LENGTH(bufev->output) &&
+ evbuffer_get_length(bufev->output) &&
!be_underlying_writebuf_full(bevf, state)) {
again = 1;
}
res = be_filter_process_input(bevf, state, &processed_any);
if (processed_any &&
- EVBUFFER_LENGTH(bufev->input) >= bufev->wm_read.low &&
+ evbuffer_get_length(bufev->input) >= bufev->wm_read.low &&
bufev->readcb != NULL)
(*bufev->readcb)(bufev, bufev->cbarg);
}
* read more data than would make us reach the watermark.
*/
if (bufev->wm_read.high != 0) {
- howmuch = bufev->wm_read.high - EVBUFFER_LENGTH(input);
+ howmuch = bufev->wm_read.high - evbuffer_get_length(input);
/* we somehow lowered the watermark, stop reading */
if (howmuch <= 0) {
bufferevent_wm_suspend_read(bufev);
/* Invoke the user callback - must always be called last */
- if (EVBUFFER_LENGTH(input) >= bufev->wm_read.low &&
+ if (evbuffer_get_length(input) >= bufev->wm_read.low &&
bufev->readcb != NULL)
(*bufev->readcb)(bufev, bufev->cbarg);
goto error;
}
- if (EVBUFFER_LENGTH(bufev->output)) {
+ if (evbuffer_get_length(bufev->output)) {
evbuffer_unfreeze(bufev->output, 1);
res = evbuffer_write(bufev->output, fd);
evbuffer_freeze(bufev->output, 1);
goto error;
}
- if (EVBUFFER_LENGTH(bufev->output) == 0)
+ if (evbuffer_get_length(bufev->output) == 0)
event_del(&bufev->ev_write);
/*
* low watermark.
*/
if (bufev->writecb != NULL &&
- EVBUFFER_LENGTH(bufev->output) <= bufev->wm_write.low)
+ evbuffer_get_length(bufev->output) <= bufev->wm_write.low)
(*bufev->writecb)(bufev, bufev->cbarg);
return;
reschedule:
- if (EVBUFFER_LENGTH(bufev->output) == 0)
+ if (evbuffer_get_length(bufev->output) == 0)
event_del(&bufev->ev_write);
return;
' struct evbuffer *evbuf)\n'
'{\n'
' ev_uint32_t tag;\n'
- ' while (EVBUFFER_LENGTH(evbuf) > 0) {\n'
+ ' while (evbuffer_get_length(evbuf) > 0) {\n'
' if (evtag_peek(evbuf, &tag) == -1)\n'
' return (-1);\n'
' switch (tag) {\n'
code = ['if (evtag_payload_length(%(buf)s, &%(varlen)s) == -1)',
' return (-1);',
# We do not want DoS opportunities
- 'if (%(varlen)s > EVBUFFER_LENGTH(%(buf)s))',
+ 'if (%(varlen)s > evbuffer_get_length(%(buf)s))',
' return (-1);',
'if ((%(var)s = malloc(%(varlen)s)) == NULL)',
' return (-1);',
decode_tag_internal(ev_uint32_t *ptag, struct evbuffer *evbuf, int dodrain)
{
ev_uint32_t number = 0;
- int len = EVBUFFER_LENGTH(evbuf);
+ int len = evbuffer_get_length(evbuf);
ev_uint8_t *data;
int count = 0, shift = 0, done = 0;
struct evbuffer *data)
{
evtag_encode_tag(evbuf, tag);
- encode_int(evbuf, EVBUFFER_LENGTH(data));
+ encode_int(evbuf, evbuffer_get_length(data));
evbuffer_add_buffer(evbuf, data);
}
#define DECODE_INT_INTERNAL(number, maxnibbles, pnumber, evbuf, offset) \
do { \
ev_uint8_t *data; \
- int len = EVBUFFER_LENGTH(evbuf) - offset; \
+ int len = evbuffer_get_length(evbuf) - offset; \
int nibbles = 0; \
\
if (len <= 0) \
if (evtag_decode_int(&len, evbuf) == -1)
return (-1);
- if (EVBUFFER_LENGTH(evbuf) < len)
+ if (evbuffer_get_length(evbuf) < len)
return (-1);
return (len);
if (evtag_decode_int(&len, evbuf) == -1)
return (-1);
- if (EVBUFFER_LENGTH(evbuf) < len)
+ if (evbuffer_get_length(evbuf) < len)
return (-1);
result = decode_int_internal(pinteger, evbuf, 0);
if (evtag_decode_int(&len, evbuf) == -1)
return (-1);
- if (EVBUFFER_LENGTH(evbuf) < len)
+ if (evbuffer_get_length(evbuf) < len)
return (-1);
result = decode_int64_internal(pinteger, evbuf, 0);
/* let's verify the outside parameters */
if (req->type != EVHTTP_REQ_POST ||
- EVBUFFER_LENGTH(req->input_buffer) <= 0)
+ evbuffer_get_length(req->input_buffer) <= 0)
goto error;
rpc_state = mm_calloc(1, sizeof(struct evrpc_req_generic));
evhttp_find_header(req->output_headers, "Content-Length") == NULL){
char size[12];
evutil_snprintf(size, sizeof(size), "%ld",
- (long)EVBUFFER_LENGTH(req->output_buffer));
+ (long)evbuffer_get_length(req->output_buffer));
evhttp_add_header(req->output_headers, "Content-Length", size);
}
}
*/
evhttp_maybe_add_content_length_header(
req->output_headers,
- (long)EVBUFFER_LENGTH(req->output_buffer));
+ (long)evbuffer_get_length(req->output_buffer));
}
}
}
evbuffer_add(output, "\r\n", 2);
- if (EVBUFFER_LENGTH(req->output_buffer) > 0) {
+ if (evbuffer_get_length(req->output_buffer) > 0) {
/*
* For a request, we add the POST data, for a reply, this
* is the regular data.
{
int len;
- while ((len = EVBUFFER_LENGTH(buf)) > 0) {
+ while ((len = evbuffer_get_length(buf)) > 0) {
if (req->ntoread < 0) {
/* Read chunk size */
ev_int64_t ntoread;
req->flags |= EVHTTP_REQ_DEFER_FREE;
(*req->chunk_cb)(req, req->cb_arg);
evbuffer_drain(req->input_buffer,
- EVBUFFER_LENGTH(req->input_buffer));
+ evbuffer_get_length(req->input_buffer));
req->flags &= ~EVHTTP_REQ_DEFER_FREE;
if ((req->flags & EVHTTP_REQ_NEEDS_FREE) != 0) {
return (REQUEST_CANCELED);
/* Read until connection close. */
evbuffer_add_buffer(req->input_buffer, buf);
} else if (req->chunk_cb != NULL ||
- EVBUFFER_LENGTH(buf) >= req->ntoread) {
+ evbuffer_get_length(buf) >= req->ntoread) {
/* We've postponed moving the data until now, but we're
* about to use it. */
- req->ntoread -= EVBUFFER_LENGTH(buf);
+ req->ntoread -= evbuffer_get_length(buf);
evbuffer_add_buffer(req->input_buffer, buf);
}
- if (EVBUFFER_LENGTH(req->input_buffer) > 0 && req->chunk_cb != NULL) {
+ if (evbuffer_get_length(req->input_buffer) > 0 && req->chunk_cb != NULL) {
req->flags |= EVHTTP_REQ_DEFER_FREE;
(*req->chunk_cb)(req, req->cb_arg);
req->flags &= ~EVHTTP_REQ_DEFER_FREE;
evbuffer_drain(req->input_buffer,
- EVBUFFER_LENGTH(req->input_buffer));
+ evbuffer_get_length(req->input_buffer));
if ((req->flags & EVHTTP_REQ_NEEDS_FREE) != 0) {
evhttp_request_free(req);
return;
/* we need to clean up any buffered data */
tmp = bufferevent_get_output(evcon->bufev);
- evbuffer_drain(tmp, EVBUFFER_LENGTH(tmp));
+ evbuffer_drain(tmp, evbuffer_get_length(tmp));
tmp = bufferevent_get_input(evcon->bufev);
- evbuffer_drain(tmp, EVBUFFER_LENGTH(tmp));
+ evbuffer_drain(tmp, evbuffer_get_length(tmp));
evcon->state = EVCON_DISCONNECTED;
}
event_debug(("%s: bytes to read: %d (in buffer %ld)\n",
__func__, req->ntoread,
- EVBUFFER_LENGTH(bufferevent_get_input(req->evcon->bufev))));
+ evbuffer_get_length(bufferevent_get_input(req->evcon->bufev))));
return (0);
}
evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf)
{
struct evbuffer *output = bufferevent_get_output(req->evcon->bufev);
- if (EVBUFFER_LENGTH(databuf) == 0)
+ if (evbuffer_get_length(databuf) == 0)
return;
if (!evhttp_response_needs_body(req))
return;
if (req->chunked) {
evbuffer_add_printf(output, "%x\r\n",
- (unsigned)EVBUFFER_LENGTH(databuf));
+ (unsigned)evbuffer_get_length(databuf));
}
evbuffer_add_buffer(output, databuf);
if (req->chunked) {
evbuffer_add(output, "0\r\n\r\n", 5);
evhttp_write_buffer(req->evcon, evhttp_send_done, NULL);
req->chunked = 0;
- } else if (EVBUFFER_LENGTH(output) == 0) {
+ } else if (evbuffer_get_length(output) == 0) {
/* let the connection know that we are done with the request */
evhttp_send_done(evcon, NULL);
} else {
}
}
evbuffer_add(buf, "", 1);
- p = mm_strdup((char *)EVBUFFER_DATA(buf));
+ p = mm_strdup((char*)evbuffer_pullup(buf, -1));
evbuffer_free(buf);
return (p);
*/
int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer* src);
-/** deprecated in favor of calling the functions directly */
-#define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
-/** deprecated in favor of calling the functions directly */
-#define EVBUFFER_DATA(x) evbuffer_pullup(x, -1)
-
/**
Prevent calls that modify an evbuffer from succeeding. A buffer may
frozen at the front, at the back, or at both the front and the back.
*/
unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
+/** deprecated in favor of calling the functions directly */
+#define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
+/** deprecated in favor of calling the functions directly */
+#define EVBUFFER_DATA(x) evbuffer_pullup(x, -1)
+
#endif
#include "event2/event_compat.h"
#include "event2/tag.h"
#include "event2/buffer.h"
+#include "event2/buffer_compat.h"
#include "event2/util.h"
#include "event-internal.h"
#include "log-internal.h"
evbuffer_add_printf(evb, "%s/%d", "hello", 1);
evbuffer_validate(evb);
- tt_assert(EVBUFFER_LENGTH(evb) == 7);
+ tt_assert(evbuffer_get_length(evb) == 7);
tt_assert(!memcmp((char*)EVBUFFER_DATA(evb), "hello/1", 1));
evbuffer_add_buffer(evb, evb_two);
evbuffer_drain(evb, strlen("hello/"));
evbuffer_validate(evb);
- tt_assert(EVBUFFER_LENGTH(evb) == 1);
+ tt_assert(evbuffer_get_length(evb) == 1);
tt_assert(!memcmp((char*)EVBUFFER_DATA(evb), "1", 1));
evbuffer_add_printf(evb_two, "%s", "/hello");
evbuffer_add_buffer(evb, evb_two);
evbuffer_validate(evb);
- tt_assert(EVBUFFER_LENGTH(evb_two) == 0);
- tt_assert(EVBUFFER_LENGTH(evb) == 7);
+ tt_assert(evbuffer_get_length(evb_two) == 0);
+ tt_assert(evbuffer_get_length(evb) == 7);
tt_assert(!memcmp((char*)EVBUFFER_DATA(evb), "1/hello", 7) != 0);
memset(buffer, 0, sizeof(buffer));
evbuffer_add(evb, buffer, sizeof(buffer));
evbuffer_validate(evb);
- tt_assert(EVBUFFER_LENGTH(evb) == 7 + 512);
+ tt_assert(evbuffer_get_length(evb) == 7 + 512);
tmp = (char *)evbuffer_pullup(evb, 7 + 512);
tt_assert(tmp);
evbuffer_validate(evb_two);
}
- tt_assert(EVBUFFER_LENGTH(evb_two) == 0);
- tt_assert(EVBUFFER_LENGTH(evb) == i * sizeof(buffer));
+ tt_assert(evbuffer_get_length(evb_two) == 0);
+ tt_assert(evbuffer_get_length(evb) == i * sizeof(buffer));
/* test remove buffer */
sz_tmp = sizeof(buffer)*2.5;
evbuffer_remove_buffer(evb, evb_two, sz_tmp);
- tt_assert(EVBUFFER_LENGTH(evb_two) == sz_tmp);
- tt_assert(EVBUFFER_LENGTH(evb) == sizeof(buffer) / 2);
+ tt_assert(evbuffer_get_length(evb_two) == sz_tmp);
+ tt_assert(evbuffer_get_length(evb) == sizeof(buffer) / 2);
evbuffer_validate(evb);
if (memcmp(evbuffer_pullup(
cp = evbuffer_readln(evb, &sz, EVBUFFER_EOL_ANY);
if (!cp || sz != 5 || memcmp(cp, "more\0\0", 6))
tt_abort_msg("Not as expected");
- tt_uint_op(EVBUFFER_LENGTH(evb), ==, 0);
+ tt_uint_op(evbuffer_get_length(evb), ==, 0);
evbuffer_validate(evb);
s = "\nno newline";
evbuffer_add(evb, s, strlen(s));
cp = evbuffer_readln(evb, &sz, EVBUFFER_EOL_ANY);
tt_assert(!cp);
evbuffer_validate(evb);
- evbuffer_drain(evb, EVBUFFER_LENGTH(evb));
- tt_assert(EVBUFFER_LENGTH(evb) == 0);
+ evbuffer_drain(evb, evbuffer_get_length(evb));
+ tt_assert(evbuffer_get_length(evb) == 0);
evbuffer_validate(evb);
/* Test EOL_CRLF */
cp = evbuffer_readln(evb, &sz, EVBUFFER_EOL_CRLF_STRICT);
tt_line_eq("More");
free(cp);
- tt_assert(EVBUFFER_LENGTH(evb) == 0);
+ tt_assert(evbuffer_get_length(evb) == 0);
evbuffer_validate(evb);
/* Test LF */
tt_line_eq("More");
free(cp); cp = NULL;
evbuffer_validate(evb);
- tt_assert(EVBUFFER_LENGTH(evb) == 0);
+ tt_assert(evbuffer_get_length(evb) == 0);
test_ok = 1;
end:
}
}
- tt_uint_op(sum, ==, EVBUFFER_LENGTH(buf));
+ tt_uint_op(sum, ==, evbuffer_get_length(buf));
end:
evbuffer_free(buf);
evbuffer_cb_set_flags(buf, cb2, EVBUFFER_CB_ENABLED);
evbuffer_add_reference(buf, "Goodbye", 7, NULL, NULL); /*31->38*/
evbuffer_remove_cb_entry(buf, cb1);
- evbuffer_drain(buf, EVBUFFER_LENGTH(buf)); /*38->0*/;
+ evbuffer_drain(buf, evbuffer_get_length(buf)); /*38->0*/;
tt_assert(-1 == evbuffer_remove_cb(buf, log_change_callback, NULL));
evbuffer_add(buf, "X", 1); /* 0->1 */
tt_assert(!evbuffer_remove_cb(buf, log_change_callback, buf_out2));
"0->36; 36->26; 26->31; 31->38; ");
tt_str_op(evbuffer_pullup(buf_out2, -1), ==,
"0->36; 31->38; 38->0; 0->1; ");
- evbuffer_drain(buf_out1, EVBUFFER_LENGTH(buf_out1));
- evbuffer_drain(buf_out2, EVBUFFER_LENGTH(buf_out2));
+ evbuffer_drain(buf_out1, evbuffer_get_length(buf_out1));
+ evbuffer_drain(buf_out2, evbuffer_get_length(buf_out2));
/* Let's test the obsolete buffer_setcb function too. */
cb1 = evbuffer_add_cb(buf, log_change_callback, buf_out1);
cb2 = evbuffer_add_cb(buf, log_change_callback, buf_out2);
evbuffer_setcb(buf, self_draining_callback, NULL);
evbuffer_add_printf(buf, "This should get drained right away.");
- tt_uint_op(EVBUFFER_LENGTH(buf), ==, 0);
- tt_uint_op(EVBUFFER_LENGTH(buf_out1), ==, 0);
- tt_uint_op(EVBUFFER_LENGTH(buf_out2), ==, 0);
+ tt_uint_op(evbuffer_get_length(buf), ==, 0);
+ tt_uint_op(evbuffer_get_length(buf_out1), ==, 0);
+ tt_uint_op(evbuffer_get_length(buf_out2), ==, 0);
evbuffer_setcb(buf, NULL, NULL);
evbuffer_add_printf(buf, "This will not.");
tt_str_op(evbuffer_pullup(buf, -1), ==, "This will not.");
- evbuffer_drain(buf, EVBUFFER_LENGTH(buf));
+ evbuffer_drain(buf, evbuffer_get_length(buf));
#if 0
/* Now let's try a suspended callback. */
evbuffer_cb_unsuspend(buf,cb2);
evbuffer_drain(buf, 4); /* 15->11 */
evbuffer_cb_unsuspend(buf,cb1);
- evbuffer_drain(buf, EVBUFFER_LENGTH(buf)); /* 11->0 */
+ evbuffer_drain(buf, evbuffer_get_length(buf)); /* 11->0 */
tt_str_op(evbuffer_pullup(buf_out1, -1), ==,
"0->11; 11->11; 11->0; ");
static void
readcb(struct bufferevent *bev, void *arg)
{
- if (EVBUFFER_LENGTH(bev->input) == 8333) {
+ if (evbuffer_get_length(bev->input) == 8333) {
struct evbuffer *evbuf = evbuffer_new();
assert(evbuf != NULL);
bufferevent_disable(bev, EV_READ);
- if (EVBUFFER_LENGTH(evbuf) == 8333) {
+ if (evbuffer_get_length(evbuf) == 8333) {
test_ok++;
}
static void
writecb(struct bufferevent *bev, void *arg)
{
- if (EVBUFFER_LENGTH(bev->output) == 0) {
+ if (evbuffer_get_length(bev->output) == 0) {
test_ok++;
}
}
wm_readcb(struct bufferevent *bev, void *arg)
{
struct evbuffer *evbuf = evbuffer_new();
- int len = EVBUFFER_LENGTH(bev->input);
+ int len = evbuffer_get_length(bev->input);
static int nread;
assert(len >= 10 && len <= 20);
static void
wm_writecb(struct bufferevent *bev, void *arg)
{
- assert(EVBUFFER_LENGTH(bev->output) <= 100);
- if (EVBUFFER_LENGTH(bev->output) == 0) {
- evbuffer_drain(bev->output, EVBUFFER_LENGTH(bev->output));
+ assert(evbuffer_get_length(bev->output) <= 100);
+ if (evbuffer_get_length(bev->output) == 0) {
+ evbuffer_drain(bev->output, evbuffer_get_length(bev->output));
test_ok++;
}
}
const unsigned char *buffer;
int i;
- buffer = evbuffer_pullup(src, EVBUFFER_LENGTH(src));
- for (i = 0; i < EVBUFFER_LENGTH(src); i += 2) {
+ buffer = evbuffer_pullup(src, evbuffer_get_length(src));
+ for (i = 0; i < evbuffer_get_length(src); i += 2) {
assert(buffer[i] == 'x');
evbuffer_add(dst, buffer + i + 1, 1);
- if (i + 2 > EVBUFFER_LENGTH(src))
+ if (i + 2 > evbuffer_get_length(src))
break;
}
const unsigned char *buffer;
int i;
- buffer = evbuffer_pullup(src, EVBUFFER_LENGTH(src));
- for (i = 0; i < EVBUFFER_LENGTH(src); ++i) {
+ buffer = evbuffer_pullup(src, evbuffer_get_length(src));
+ for (i = 0; i < evbuffer_get_length(src); ++i) {
evbuffer_add(dst, "x", 1);
evbuffer_add(dst, buffer + i, 1);
}
- evbuffer_drain(src, EVBUFFER_LENGTH(src));
+ evbuffer_drain(src, evbuffer_get_length(src));
return (BEV_OK);
}
assert(res == Z_OK || res == Z_STREAM_END);
}
- } while (EVBUFFER_LENGTH(src) > 0);
+ } while (evbuffer_get_length(src) > 0);
++infilter_calls;
assert(res == Z_OK || res == Z_STREAM_END);
}
- } while (EVBUFFER_LENGTH(src) > 0);
+ } while (evbuffer_get_length(src) > 0);
++outfilter_calls;
static void
readcb(struct bufferevent *bev, void *arg)
{
- if (EVBUFFER_LENGTH(bufferevent_get_input(bev)) == 8333) {
+ if (evbuffer_get_length(bufferevent_get_input(bev)) == 8333) {
struct evbuffer *evbuf = evbuffer_new();
assert(evbuf != NULL);
bufferevent_disable(bev, EV_READ);
- if (EVBUFFER_LENGTH(evbuf) == 8333) {
+ if (evbuffer_get_length(evbuf) == 8333) {
++readcb_finished;
}
static void
writecb(struct bufferevent *bev, void *arg)
{
- if (EVBUFFER_LENGTH(bufferevent_get_output(bev)) == 0) {
+ if (evbuffer_get_length(bufferevent_get_output(bev)) == 0) {
++writecb_finished;
}
}