[systemd-devel] [PATCH] core/socket: we only want one event on standard sockets

Shawn shawn at churchofgit.com
Fri Nov 22 19:50:37 PST 2013


oh wait, this doesn't build, here is a version that builds

On Fri, Nov 22, 2013 at 6:56 PM, Shawn Landden <shawn at churchofgit.com> wrote:
> With EPOLLONESHOT we are guaranteed to only recieve one event
> until we reload with socket_enter_listening(s), otherwise
> multiple events can be generated upon receipt of multiple chunks of data.
>
> We also only want wake-ups when external events happen, i.e.
> edge-triggered wakeups.
> ---
>  src/core/socket.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/core/socket.c b/src/core/socket.c
> index 5fa4a5a..2f860a4 100644
> --- a/src/core/socket.c
> +++ b/src/core/socket.c
> @@ -1119,7 +1119,9 @@ static int socket_watch_fds(Socket *s) {
>                  if (p->event_source)
>                          r = sd_event_source_set_enabled(p->event_source, SD_EVENT_ON);
>                  else
> -                        r = sd_event_add_io(UNIT(s)->manager->event, p->fd, EPOLLIN, socket_dispatch_io, p, &p->event_source);
> +                        r = sd_event_add_io(UNIT(s)->manager->event, p->fd,
> +                                        EPOLLIN|EPOLLET|((s->accept || s->distribute) ? 0 : EPOLLONESHOT),
> +                                        socket_dispatch_io, p, &p->event_source);
>
>                  if (r < 0) {
>                          log_warning_unit(UNIT(s)->id, "Failed to watch listening fds: %s", strerror(-r));
> --
> 1.8.4.4
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-core-socket-we-only-want-one-event-on-standard-socke.patch
Type: text/x-patch
Size: 1456 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131122/7b2e83fe/attachment.bin>


More information about the systemd-devel mailing list