From 015b269c21fa5ffd6923db3ea5a7a293106338e0 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 5 Feb 2018 15:18:19 +0100 Subject: [PATCH] Making sure cSVDRPClient::Process() reads the entire reply once it started reading, even if no Response parameter is given --- HISTORY | 4 +++- svdrp.c | 13 ++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/HISTORY b/HISTORY index 1d9b6ef8..cdb2d19f 100644 --- a/HISTORY +++ b/HISTORY @@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History a subdirectory. - SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details). -2018-02-03: Version 2.3.9 +2018-02-05: Version 2.3.9 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). @@ -9257,3 +9257,5 @@ Video Disk Recorder Revision History - The Perl script 'peerdemo' shows how one can find all the VDRs in the local network using the peer connection mechanism. - Added the UPDATE-2.4.0 file. +- Making sure cSVDRPClient::Process() reads the entire reply once it started reading, + even if no Response parameter is given. diff --git a/svdrp.c b/svdrp.c index 48a76dc6..c3cc7527 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 4.23 2017/11/11 12:04:17 kls Exp $ + * $Id: svdrp.c 4.24 2018/02/05 14:52:27 kls Exp $ */ #include "svdrp.h" @@ -425,11 +425,8 @@ bool cSVDRPClient::Process(cStringList *Response) // make sure the string is terminated: input[numChars] = 0; dbgsvdrp("< %s: %s\n", *serverName, input); - if (Response) { + if (Response) Response->Append(strdup(input)); - if (numChars >= 4 && input[3] != '-') // no more lines will follow - break; - } else { switch (atoi(input)) { case 220: if (numChars > 4) { @@ -448,6 +445,8 @@ bool cSVDRPClient::Process(cStringList *Response) break; } } + if (numChars >= 4 && input[3] != '-') // no more lines will follow + break; numChars = 0; } else { @@ -467,12 +466,12 @@ bool cSVDRPClient::Process(cStringList *Response) return false; } } - else if (!Response) - break; else if (Timeout.TimedOut()) { esyslog("SVDRP < %s timeout while waiting for response from '%s'", ipAddress.Connection(), *serverName); return false; } + else if (!Response && numChars == 0) + break; // we read all or nothing! } if (pingTime.TimedOut()) Execute("PING");