mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
One review comment and something I forgot :-(
git-svn-id: file:///svn/unbound/branches/ub_event@3648 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
bcfbe0d9c4
commit
e82aa87a2b
2 changed files with 14 additions and 26 deletions
|
|
@ -123,11 +123,14 @@ struct ub_event_base {
|
|||
* The Virtual Method Table for and ub_event "object"
|
||||
*/
|
||||
struct ub_event_vmt {
|
||||
/** Add event bits for this event to fire on */
|
||||
/** Add event bits for this event to fire on.
|
||||
* The event will be deactivated before this function is called. */
|
||||
void (*add_bits)(struct ub_event*, short);
|
||||
/** Configure the event so it will not longer fire on given bits */
|
||||
/** Configure the event so it will not longer fire on given bits
|
||||
* The event will be deactivated before this function is called. */
|
||||
void (*del_bits)(struct ub_event*, short);
|
||||
/** Change or set the file descriptor on the event */
|
||||
/** Change or set the file descriptor on the event
|
||||
* The event will be deactivated before this function is called. */
|
||||
void (*set_fd)(struct ub_event*, int);
|
||||
/** Destructor for the ub_event object */
|
||||
void (*free)(struct ub_event*);
|
||||
|
|
|
|||
|
|
@ -148,21 +148,6 @@ static struct comm_point* comm_point_create_tcp_handler(
|
|||
|
||||
/* -------- End of local definitions -------- */
|
||||
|
||||
#ifdef USE_MINI_EVENT
|
||||
/** minievent updates the time when it blocks. */
|
||||
#define comm_base_now(x) /* nothing to do */
|
||||
#else /* !USE_MINI_EVENT */
|
||||
/** fillup the time values in the event base */
|
||||
static void
|
||||
comm_base_now(struct comm_base* b)
|
||||
{
|
||||
if(gettimeofday(&b->eb->now, NULL) < 0) {
|
||||
log_err("gettimeofday: %s", strerror(errno));
|
||||
}
|
||||
b->eb->secs = (time_t)b->eb->now.tv_sec;
|
||||
}
|
||||
#endif /* USE_MINI_EVENT */
|
||||
|
||||
struct comm_base*
|
||||
comm_base_create(int sigs)
|
||||
{
|
||||
|
|
@ -202,7 +187,7 @@ comm_base_create_event(struct ub_event_base* base)
|
|||
return NULL;
|
||||
}
|
||||
b->eb->base = base;
|
||||
comm_base_now(b);
|
||||
ub_comm_base_now(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
@ -597,7 +582,7 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
|
|||
if(!(event&UB_EV_READ))
|
||||
return;
|
||||
log_assert(rep.c && rep.c->buffer && rep.c->fd == fd);
|
||||
comm_base_now(rep.c->ev->base);
|
||||
ub_comm_base_now(rep.c->ev->base);
|
||||
for(i=0; i<NUM_UDP_PER_SELECT; i++) {
|
||||
sldns_buffer_clear(rep.c->buffer);
|
||||
rep.addrlen = (socklen_t)sizeof(rep.addr);
|
||||
|
|
@ -685,7 +670,7 @@ comm_point_udp_callback(int fd, short event, void* arg)
|
|||
if(!(event&UB_EV_READ))
|
||||
return;
|
||||
log_assert(rep.c && rep.c->buffer && rep.c->fd == fd);
|
||||
comm_base_now(rep.c->ev->base);
|
||||
ub_comm_base_now(rep.c->ev->base);
|
||||
for(i=0; i<NUM_UDP_PER_SELECT; i++) {
|
||||
sldns_buffer_clear(rep.c->buffer);
|
||||
rep.addrlen = (socklen_t)sizeof(rep.addr);
|
||||
|
|
@ -868,7 +853,7 @@ comm_point_tcp_accept_callback(int fd, short event, void* arg)
|
|||
log_info("ignoring tcp accept event %d", (int)event);
|
||||
return;
|
||||
}
|
||||
comm_base_now(c->ev->base);
|
||||
ub_comm_base_now(c->ev->base);
|
||||
/* find free tcp handler. */
|
||||
if(!c->tcp_free) {
|
||||
log_warn("accepted too many tcp, connections full");
|
||||
|
|
@ -1454,7 +1439,7 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg)
|
|||
{
|
||||
struct comm_point* c = (struct comm_point*)arg;
|
||||
log_assert(c->type == comm_tcp);
|
||||
comm_base_now(c->ev->base);
|
||||
ub_comm_base_now(c->ev->base);
|
||||
|
||||
if(event&UB_EV_READ) {
|
||||
if(!comm_point_tcp_handle_read(fd, c, 0)) {
|
||||
|
|
@ -1497,7 +1482,7 @@ void comm_point_local_handle_callback(int fd, short event, void* arg)
|
|||
{
|
||||
struct comm_point* c = (struct comm_point*)arg;
|
||||
log_assert(c->type == comm_local);
|
||||
comm_base_now(c->ev->base);
|
||||
ub_comm_base_now(c->ev->base);
|
||||
|
||||
if(event&UB_EV_READ) {
|
||||
if(!comm_point_tcp_handle_read(fd, c, 1)) {
|
||||
|
|
@ -1516,7 +1501,7 @@ void comm_point_raw_handle_callback(int ATTR_UNUSED(fd),
|
|||
struct comm_point* c = (struct comm_point*)arg;
|
||||
int err = NETEVENT_NOERROR;
|
||||
log_assert(c->type == comm_raw);
|
||||
comm_base_now(c->ev->base);
|
||||
ub_comm_base_now(c->ev->base);
|
||||
|
||||
if(event&UB_EV_TIMEOUT)
|
||||
err = NETEVENT_TIMEOUT;
|
||||
|
|
@ -2205,7 +2190,7 @@ comm_signal_callback(int sig, short event, void* arg)
|
|||
struct comm_signal* comsig = (struct comm_signal*)arg;
|
||||
if(!(event & UB_EV_SIGNAL))
|
||||
return;
|
||||
comm_base_now(comsig->base);
|
||||
ub_comm_base_now(comsig->base);
|
||||
fptr_ok(fptr_whitelist_comm_signal(comsig->callback));
|
||||
(*comsig->callback)(sig, comsig->cb_arg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue