Fixed a possible deadlock in case two SVDRP clients send each other POLL commands at the same time

This commit is contained in:
Klaus Schmidinger 2022-11-19 15:49:27 +01:00
parent b14ed38a48
commit 83c9677899
2 changed files with 5 additions and 5 deletions

View File

@ -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. - 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). - Fixed default values for DVB-T (thanks to Winfried Köhler and Jose Angel).
- Removed some unnecessary locks from SVDRPClientHandler. - Removed some unnecessary locks from SVDRPClientHandler.
- Fixed a possible deadlock in case two SVDRP clients send each other POLL commands
at the same time.

View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured * and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection. * 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" #include "svdrp.h"
@ -2380,10 +2380,8 @@ void cSVDRPServer::CmdPOLL(const char *Option)
if (SVDRPClientHandler) { if (SVDRPClientHandler) {
if (ListName) { if (ListName) {
if (strcasecmp(ListName, "timers") == 0) { if (strcasecmp(ListName, "timers") == 0) {
if (SVDRPClientHandler->TriggerFetchingTimers(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
Reply(250, "OK"); SVDRPClientHandler->TriggerFetchingTimers(RemoteName);
else
Reply(501, "No connection to \"%s\"", RemoteName);
} }
else else
Reply(501, "Unknown list name: \"%s\"", ListName); Reply(501, "Unknown list name: \"%s\"", ListName);