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

[Libevent-users] Recommended way of notifying all active sessions



Hello. I bet that this question was already asked a couple of times, but… What is the right way to execute some action for all currently registered descriptors? Let imagine that I have a lot of active client sessions that must save some state to DB when socket is closed and that I use buffered events to handle network IO. Everything is fine when connection is closed from client side. In this case assigned event callback is called. But what should I do at application shutdown (for example due to received signal)?

Currently I maintain a separate mapping from socket descriptor to connection specific data, that is properly updated when new connections are opened and/or current connections are closed. This way I have an up-to-date list of active sessions at application shutdown. But it does not seem right, as I'm essentially duplicating a part of information that is already stored by event_base. How would you solve this problem? Thanks in advance.

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