[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0908260802520.6557@makko.or.mcafeemobile.com>
Date: Wed, 26 Aug 2009 08:04:32 -0700 (PDT)
From: Davide Libenzi <davidel@...ilserver.org>
To: Will Brown <dr.hfuhruhurr@...il.com>
cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: PROBLEM: Epoll frequently fails to notify connects at connect
bursts
On Wed, 26 Aug 2009, Will Brown wrote:
> On Wed, Aug 26, 2009 at 3:24 AM, Davide Libenzi<davidel@...ilserver.org> wrote:
> > On Tue, 25 Aug 2009, Davide Libenzi wrote:
> >
> >> Multiple quasi-simultaneous events for the same fd are merged. This is why
> >> on POLLIN on accepting sockets you want to do something like:
> >>
> >> while ((afd = accept(sfd, ...)) != -1)
> >> add_client(afd);
> >
> > Of course, with sfd in non-blocking mode. Alternatively, you drop EPOLLET
> > for the sfd socket.
> >
>
> Aha! Thank you immensely Davide. It cost me one week of frustration already.
>
> 1. Where should I have picked up this gem of essential information? I
> haven't seen it in the man-pages for either 'epoll' or 'accept'.
>
> 2. Is it better to use a level-triggered listener socket, or to use
> the accept-loop?
EPOLLET can be more efficent, but it can also be a little more trickier to
grasp. LT mode maps more closely to poll/select, that makes it more
familiar to users.
- Davide
Powered by blists - more mailing lists