On Fri, 2012-04-20 at 18:06 +0200, Gergely Nagy wrote:
When initializing an unix-dgram socket, set self->fd to the acquired socket FD, so that fds inherited from systemd actually get used and polled on.
Signed-off-by: Gergely Nagy <algernon@balabit.hu> --- modules/afsocket/afsocket.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules/afsocket/afsocket.c b/modules/afsocket/afsocket.c index 5b192f4..c1bee5c 100644 --- a/modules/afsocket/afsocket.c +++ b/modules/afsocket/afsocket.c @@ -679,7 +679,7 @@ afsocket_sd_init(LogPipe *s) if (sock == -1 && !afsocket_open_socket(self->bind_addr, !!(self->flags & AFSOCKET_STREAM), &sock)) return self->super.super.optional; } - self->fd = -1; + self->fd = sock;
if (!self->setup_socket(self, sock)) {
hmm... this is exactly the case where a variable with a better name would have prevented some effort. self->fd is the _listener_ fd which a SOCK_DGRAM style socket lacks. That's why it is set to -1 The dgram socket is processed as if it was a single connection, a couple of lines below this hunk, there's a call to afsocket_sd_process_connection(), which should initialize an AFSocketSourceConnection object, which in turn should start polling that fd. What was your intent here? -- Bazsi