]> git.ipfire.org Git - thirdparty/postgresql.git/commit
oauth: Remove expired timers from the multiplexer
authorJacob Champion <jchampion@postgresql.org>
Fri, 8 Aug 2025 15:44:52 +0000 (08:44 -0700)
committerJacob Champion <jchampion@postgresql.org>
Fri, 8 Aug 2025 15:48:23 +0000 (08:48 -0700)
commite507e08acf63ffa6777424f53cec24e6a1363571
treefaef091d711201cea694ed1dddf239e8055c99a7
parent16b0c48583a5043f46d75cde99d8a3ffbd9c7c98
oauth: Remove expired timers from the multiplexer

In a case similar to the previous commit, an expired timer can remain
permanently readable if Curl does not remove the timeout itself. Since
that removal isn't guaranteed to happen in real-world situations,
implement drain_timer_events() to reset the timer before calling into
drive_request().

Moving to drain_timer_events() happens to fix a logic bug in the
previous caller of timer_expired(), which treated an error condition as
if the timer were expired instead of bailing out.

The previous implementation of timer_expired() gave differing results
for epoll and kqueue if the timer was reset. (For epoll, a reset timer
was considered to be expired, and for kqueue it was not.) This didn't
previously cause problems, since timer_expired() was only called while
the timer was known to be set, but both implementations now use the
kqueue logic.

Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com
src/interfaces/libpq-oauth/oauth-curl.c