]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: mention that dns_stream_update() needs to be called after dns_stream_take_re...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 28 Jan 2022 00:01:07 +0000 (09:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 28 Jan 2022 00:01:07 +0000 (09:01 +0900)
Based on the analysis by Joan Bruguera <joanbrugueram@gmail.com>.
See https://github.com/systemd/systemd/pull/22132#discussion_r793951650.

src/resolve/resolved-dns-stream.c

index 1b2db5121296a6e45f6da349323a3ecf12678848..d16ea95d434534b0b023a53c322d9f9637843024 100644 (file)
@@ -284,6 +284,13 @@ static int on_stream_timeout(sd_event_source *es, usec_t usec, void *userdata) {
 static DnsPacket *dns_stream_take_read_packet(DnsStream *s) {
         assert(s);
 
+        /* Note, dns_stream_update() should be called after this is called. When this is called, the
+         * stream may be already full and the EPOLLIN flag is dropped from the stream IO event source.
+         * Even this makes a room to read in the stream, this does not call dns_stream_update(), hence
+         * EPOLLIN flag is not set automatically. So, to read further packets from the stream,
+         * dns_stream_update() must be called explicitly. Currently, this is only called from
+         * on_stream_io_impl(), and there dns_stream_update() is called. */
+
         if (!s->read_packet)
                 return NULL;