diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-01-28 09:01:07 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-18 02:36:10 +0900 |
commit | d65808ef7e0fe558923336a8533df37ecb50dbfc (patch) | |
tree | 74413000cb5e9fbb1c11c0d4798688c1c4f9dcf7 | |
parent | b2f82f643a9c9609058ed877b3d722b3822d484c (diff) | |
download | systemd-d65808ef7e0fe558923336a8533df37ecb50dbfc.tar.gz |
resolve: mention that dns_stream_update() needs to be called after dns_stream_take_read_packet()
Based on the analysis by Joan Bruguera <joanbrugueram@gmail.com>.
See https://github.com/systemd/systemd/pull/22132#discussion_r793951650.
(cherry picked from commit 4aa6129897d2e8de9b275b44270c1c9da745de0e)
-rw-r--r-- | src/resolve/resolved-dns-stream.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c index 1b2db51212..d16ea95d43 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c @@ -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; |