From efcb25b78a9a91a309433347795b2df0c60d0972 Mon Sep 17 00:00:00 2001 From: wens Date: Sun, 14 Jun 2009 15:35:09 +0000 Subject: Bufferevent error callback is REQUIRED git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4614 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- daemon/logind/logind.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'daemon/logind/logind.c') diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c index a816115f..d322e16c 100644 --- a/daemon/logind/logind.c +++ b/daemon/logind/logind.c @@ -1068,6 +1068,15 @@ endconn_cb(int fd, short event, void *arg) if (g_verbose) fprintf(stderr, " done.\r\n"); } +static void +endconn_cb_buffer(struct bufferevent * evb, short event, void *arg) +{ + login_conn_ctx *conn = (login_conn_ctx*) arg; + + // "event" for bufferevent and normal event are different + endconn_cb(EVENT_FD(&conn->ev), 0, arg); +} + static void login_conn_remove(login_conn_ctx *conn, int fd, int sleep_sec) { @@ -1231,7 +1240,7 @@ listen_cb(int lfd, short event, void *arg) } memset(conn, 0, sizeof(login_conn_ctx)); - if ((conn->bufev = bufferevent_new(fd, NULL, NULL, NULL, NULL)) == NULL) { + if ((conn->bufev = bufferevent_new(fd, NULL, NULL, endconn_cb_buffer, conn)) == NULL) { free(conn); close(fd); return; -- cgit v1.2.3