]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: only call complete() with zero argument in LLMNR client cases
authorLennart Poettering <lennart@poettering.net>
Mon, 21 Jan 2019 18:32:32 +0000 (19:32 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Feb 2019 16:13:58 +0000 (17:13 +0100)
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.

src/resolve/resolved-dns-stream.c

index ecc7e9fa091516b8bbf0fced5877666d8ab7501a..45b06eb732e9b5b2891d326b510726121f96db65 100644 (file)
@@ -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);