mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added timeouts for SVDRP peer communication about timers
This commit is contained in:
parent
66d66b31dc
commit
4d7455e783
15
svdrp.c
15
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.31 2018/02/28 10:04:00 kls Exp $
|
||||
* $Id: svdrp.c 4.32 2018/03/01 14:45:57 kls Exp $
|
||||
*/
|
||||
|
||||
#include "svdrp.h"
|
||||
@ -483,7 +483,6 @@ bool cSVDRPClient::HasFetchFlag(eSvdrpFetchFlags Flag)
|
||||
|
||||
bool cSVDRPClient::GetRemoteTimers(cStringList &Response)
|
||||
{
|
||||
if (HasFetchFlag(sffTimers)) {
|
||||
if (Execute("LSTT ID", &Response)) {
|
||||
for (int i = 0; i < Response.Size(); i++) {
|
||||
char *s = Response[i];
|
||||
@ -499,7 +498,6 @@ bool cSVDRPClient::GetRemoteTimers(cStringList &Response)
|
||||
Response.SortNumerically();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -629,19 +627,26 @@ void cSVDRPClientHandler::SendDiscover(void)
|
||||
void cSVDRPClientHandler::ProcessConnections(void)
|
||||
{
|
||||
cString PollTimersCmd;
|
||||
if (cTimers::GetTimersRead(timersStateKey)) {
|
||||
if (cTimers::GetTimersRead(timersStateKey, 100)) {
|
||||
PollTimersCmd = cString::sprintf("POLL %s TIMERS", Setup.SVDRPHostName);
|
||||
timersStateKey.Remove();
|
||||
}
|
||||
else if (timersStateKey.TimedOut())
|
||||
return; // try again next time
|
||||
for (int i = 0; i < clientConnections.Size(); i++) {
|
||||
cSVDRPClient *Client = clientConnections[i];
|
||||
if (Client->Process()) {
|
||||
if (Client->HasFetchFlag(sffTimers)) {
|
||||
cStringList RemoteTimers;
|
||||
if (Client->GetRemoteTimers(RemoteTimers)) {
|
||||
cTimers *Timers = cTimers::GetTimersWrite(timersStateKey);
|
||||
if (cTimers *Timers = cTimers::GetTimersWrite(timersStateKey, 100)) {
|
||||
bool TimersModified = Timers->StoreRemoteTimers(Client->ServerName(), &RemoteTimers);
|
||||
timersStateKey.Remove(TimersModified);
|
||||
}
|
||||
else
|
||||
Client->SetFetchFlag(sffTimers); // try again next time
|
||||
}
|
||||
}
|
||||
if (*PollTimersCmd) {
|
||||
if (!Client->Execute(PollTimersCmd))
|
||||
esyslog("ERROR: can't send '%s' to '%s'", *PollTimersCmd, Client->ServerName());
|
||||
|
Loading…
Reference in New Issue
Block a user