[lkml]   [2003]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [Patch][RFC] epoll and half closed TCP connections
Eric Varsanyi wrote:
> - epoll_wait() returns a single EPOLLIN event on the FD representing
> both the 1/2 shutdown state and data available


> At this point there is no way the app can tell if there is a half closed
> connection so it may issue a close() back to the client after writing
> results. Normally the server would distinguish these events by assuming
> EOF if it got a read ready indication and the first read returned 0 bytes,
> or would issue read calls until less data was returned than was asked for.
> In a level triggered world this all just works because the read ready
> indication is driven back to the app as long as the socket state is half
> closed. The event driven epoll mechanism folds these two indications
> together and thus loses one 'edge'.

Well then, use epoll's level-triggered mode. It's quite easy - it's
the default now. :)

If there's an EOF condition pending after you called read(), and then
you call epoll_wait(), you _should_ see another EPOLLIN condition

If you aren't seeing epoll_wait() return with EPOLLIN when there's an
EOF pending, *and* you haven't set EPOLLET in the event flags, that's
a bug in epoll. Is that what you're seeing?

-- Jamie
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:46    [W:0.133 / U:3.212 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site