Making sure cSVDRPClient::Process() reads the entire reply once it started reading, even if no Response parameter is given

This commit is contained in:
Klaus Schmidinger 2018-02-05 15:18:19 +01:00
parent 802544662d
commit 015b269c21
2 changed files with 9 additions and 8 deletions

View File

@ -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.

13
svdrp.c
View File

@ -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");