diff options
| author | provos <provos@NetBSD.org> | 2005-04-17 07:20:00 +0000 |
|---|---|---|
| committer | provos <provos@NetBSD.org> | 2005-04-17 07:20:00 +0000 |
| commit | bdc32cfad70e99cc346d62b16531b152fea38dbc (patch) | |
| tree | c457ab322c6312bfd7b8fa25cc81421b80c26c69 /lib/libevent/evbuffer.c | |
| parent | 17a32ff3f7b320a522ad92d25aca8bcf55b81716 (diff) | |
update to libevent-1.0c. This includes support for event priorities,
multi-threaded applications and some bug fixes. regression test
improved to test for new features. bump major.
Diffstat (limited to 'lib/libevent/evbuffer.c')
| -rw-r--r-- | lib/libevent/evbuffer.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/libevent/evbuffer.c b/lib/libevent/evbuffer.c index 10bd97ec074..b6a6702971f 100644 --- a/lib/libevent/evbuffer.c +++ b/lib/libevent/evbuffer.c @@ -1,4 +1,4 @@ -/* $NetBSD: evbuffer.c,v 1.2 2004/12/06 13:16:36 wiz Exp $ */ +/* $NetBSD: evbuffer.c,v 1.3 2005/04/17 07:20:00 provos Exp $ */ /* * Copyright (c) 2002-2004 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -37,8 +37,10 @@ #include "event.h" -void bufferevent_read_pressure_cb(struct evbuffer *, size_t, size_t, void *); +/* prototypes */ + void bufferevent_setwatermark(struct bufferevent *, short, size_t, size_t); +void bufferevent_read_pressure_cb(struct evbuffer *, size_t, size_t, void *); static int bufferevent_add(struct event *ev, int timeout) @@ -144,7 +146,9 @@ bufferevent_writecb(int fd, short event, void *arg) if (EVBUFFER_LENGTH(bufev->output)) { res = evbuffer_write(bufev->output, fd); if (res == -1) { - if (errno == EAGAIN || errno == EINTR) + if (errno == EAGAIN || + errno == EINTR || + errno == EINPROGRESS) goto reschedule; /* error case */ what |= EVBUFFER_ERROR; @@ -219,6 +223,17 @@ bufferevent_new(int fd, evbuffercb readcb, evbuffercb writecb, return (bufev); } +int +bufferevent_priority_set(struct bufferevent *bufev, int priority) +{ + if (event_priority_set(&bufev->ev_read, priority) == -1) + return (-1); + if (event_priority_set(&bufev->ev_write, priority) == -1) + return (-1); + + return (0); +} + void bufferevent_free(struct bufferevent *bufev) { |
