From 83c96778993e2350b428881b48c535be6e7d5618 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 19 Nov 2022 15:49:27 +0100 Subject: [PATCH] Fixed a possible deadlock in case two SVDRP clients send each other POLL commands at the same time --- HISTORY | 2 ++ svdrp.c | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index 9789e2f3..d50579e9 100644 --- a/HISTORY +++ b/HISTORY @@ -9797,3 +9797,5 @@ Video Disk Recorder Revision History - Added a warning if an attempt is made to obtain a write lock twice from the same thread. - Fixed default values for DVB-T (thanks to Winfried Köhler and Jose Angel). - Removed some unnecessary locks from SVDRPClientHandler. +- Fixed a possible deadlock in case two SVDRP clients send each other POLL commands + at the same time. diff --git a/svdrp.c b/svdrp.c index 10e44389..0332512d 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 5.4 2022/11/19 15:47:03 kls Exp $ + * $Id: svdrp.c 5.5 2022/11/19 15:49:27 kls Exp $ */ #include "svdrp.h" @@ -2380,10 +2380,8 @@ void cSVDRPServer::CmdPOLL(const char *Option) if (SVDRPClientHandler) { if (ListName) { if (strcasecmp(ListName, "timers") == 0) { - if (SVDRPClientHandler->TriggerFetchingTimers(RemoteName)) - Reply(250, "OK"); - else - Reply(501, "No connection to \"%s\"", RemoteName); + Reply(250, "OK"); // must send reply before calling TriggerFetchingTimers() to avoid a deadlock if two clients send each other POLL commands at the same time + SVDRPClientHandler->TriggerFetchingTimers(RemoteName); } else Reply(501, "Unknown list name: \"%s\"", ListName);