[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] Event loop not exiting when freeing bufferevent



Hi,

Me again!

I was wondering. The documentation says that the libevent loop exits when there are no events left to process. For some reason my event loop keeps running tho, even after I've disabled the bufferevent and have freed it.

My bufferevent is created with the 'BEV_OPT_CLOSE_ON_FREE' flag.

I'm calling the following snippet of code when I receive an event with the BEV_EVENT_EOF flag set:

 printf("Connection lost, freeing bufferevent..\n");
 bufferevent_disable(client->event, EV_READ|EV_WRITE);
 bufferevent_free(client->event);

That seems to work fine (no errors occur, bufferevent_disable() returns 0 and I can see the printf), but libevent keeps looping. Shouldn't it have stopped because I closed the last bufferevent? I've tried without the '_disable' initially, but no changes there.

Am I doing something wrong? Is there a way to see what libevent is currently doing?


***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.