resolve: llmnr: fix never hit condition
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 28 Jan 2022 00:29:59 +0000 (09:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 17 Mar 2022 17:36:10 +0000 (02:36 +0900)
commit9c710c66c383adf2aa06e8c32bac5c100cf0fd8c
tree63f8eb679be5106f9edd26509c19a557f9716b22
parentd65808ef7e0fe558923336a8533df37ecb50dbfc
resolve: llmnr: fix never hit condition

Previously, the condition in on_stream_io_impl() never hit, as the
read packet is always taken from the stream in the few lines above.

Instead of the dns_stream_complete() under the condition, the stream
is unref()ed in the on_packet callback for LLMNR stream, unlike the
other on_packet callbacks.

That's quite tricky. Also, potentially, the stream may still have
queued packets to write.

This fix the condition, and drops the unref() in the on_packet callback.

C.f. https://github.com/systemd/systemd/pull/22274#issuecomment-1023708449.

Closes #22266.

(cherry picked from commit a5e2a488e83fabf6d8ade7621c2fc3574a8faaa7)
src/resolve/resolved-dns-stream.c
src/resolve/resolved-dns-stream.h
src/resolve/resolved-llmnr.c