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

[Libevent-users] Re: BOUNCE libevent-users@xxxxxxxxxxxxx: Non-member submission from [Chernyshev Vyacheslav <astellar@xxxxx>]



> From: Chernyshev Vyacheslav <astellar@xxxxx>
> Content-Type: text/plain; charset=windows-1251
> Content-Transfer-Encoding: quoted-printable
> Subject: Recommended way of notifying all active sessions
> Message-Id: <42F18941-B6E5-4218-80C6-0B8BD9EB4AE9@xxxxx>
> Date: Fri, 10 Aug 2012 04:46:34 +0400
> To: libevent-users@xxxxxxxxxxxxx
> Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1485\))
> X-Mailer: Apple Mail (2.1485)
>
> Hello. I bet that this question was already asked a couple of times, =
> but=85 What is the right way to execute some action for all currently =
> registered descriptors? Let imagine that I have 500 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.=

Oops; sorry! This message has spent the last month stuck in my spam
folder, since you aren't subscribed to libevent-users.

There's a new function in the master branch in git that should do what
you want.  Have a look at event_base_foreach_event.

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