]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Properly handle reconnection failure for backend UDP sockets
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 5 Apr 2023 20:17:23 +0000 (22:17 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 12 May 2023 14:36:10 +0000 (16:36 +0200)
commit541b8df1fc0773549a76c8de13fb1123baba8bda
tree9f1dd4b5ee2e56ea5ff220e16799c6e3d98eae86
parent7b9ab64cdf7961020dccb27e600675dec661a86e
dnsdist: Properly handle reconnection failure for backend UDP sockets

We try to reconnect our UDP sockets toward backends on some kind of
network errors that indicate a topology change, but we need to be
careful to handle the case where we actually fail to reconnect, as
we end up with no remaining sockets to use.
This commit properly deals with this case by pausing the thread handling
UDP responses from the backend, instead of having it enter a busy loop,
and by attempting to reconnect if we get a `bad file number` error when
trying to send a UDP datagram to the backend.
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistdist/dnsdist-backend.cc