From: Lennart Poettering Date: Mon, 21 Jan 2019 18:32:32 +0000 (+0100) Subject: resolved: only call complete() with zero argument in LLMNR client cases X-Git-Tag: v242-rc1~276^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c9e017067a6889458e1df557a8d9e1c599fce33;p=thirdparty%2Fsystemd.git resolved: only call complete() with zero argument in LLMNR client cases In all other cases (i.e. classic DNS connection towards an upstream server, or incoming stub connection, or incoming LMMNR connection) we want long-running connections, hence keep the connection open for good. Only in the LLMNR client case let's close the stream as soon as we are done. --- diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c index ecc7e9fa091..45b06eb732e 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c @@ -425,7 +425,11 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use } } - if ((s->write_packet && s->n_written >= sizeof(s->write_size) + s->write_packet->size) && + /* Call "complete" callback if finished reading and writing one packet, and there's nothing else left + * to write. */ + if (s->type == DNS_STREAM_LLMNR_SEND && + (s->write_packet && s->n_written >= sizeof(s->write_size) + s->write_packet->size) && + ordered_set_isempty(s->write_queue) && (s->read_packet && s->n_read >= sizeof(s->read_size) + s->read_packet->size)) return dns_stream_complete(s, 0);