Skip to content

Commit

Permalink
Check event mask against the right struct member.
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Rarick committed Sep 25, 2007
1 parent f5915c3 commit 614d39a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion beanstalkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ reset_conn(conn c)
fprintf(stderr, "%d: resetting back to STATE_WANTCOMMAND\n", c->fd);

r = conn_update_evq(c, EV_READ | EV_PERSIST, NULL);
if (r == -1) return warn("update flags failed"), conn_close(c);
if (r == -1) return warn("update events failed"), conn_close(c);

/* we are done transferring the job, so reset */
if (c->reserved_job) c->reserved_job->data_xfer = 0;
Expand Down
8 changes: 4 additions & 4 deletions conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ make_conn(int fd, char start_state)
}

int
conn_update_evq(conn c, const int flags, evh handler)
conn_update_evq(conn c, const int events, evh handler)
{
int r;

if (!c) return -1;

if (c->evq.ev_flags == flags) return 0;
if (c->evq.ev_events == events) return 0;

/* If it's been added, try to delete it first */
if (c->evq.ev_base) {
r = event_del(&c->evq);
if (r == -1) return -1;
}

/* set the flags and handler, but don't change any existing handler */
event_set(&c->evq, c->fd, flags, c->evq.ev_callback ? : handler, c);
/* set the events and handler, but don't change any existing handler */
event_set(&c->evq, c->fd, events, c->evq.ev_callback ? : handler, c);

r = event_add(&c->evq, NULL);
if (r == -1) return -1;
Expand Down

0 comments on commit 614d39a

Please sign in to comment.