mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Added timeouts for SVDRP peer communication about timers
This commit is contained in:
parent
66d66b31dc
commit
4d7455e783
49
svdrp.c
49
svdrp.c
@ -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 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"
|
#include "svdrp.h"
|
||||||
@ -483,22 +483,20 @@ bool cSVDRPClient::HasFetchFlag(eSvdrpFetchFlags Flag)
|
|||||||
|
|
||||||
bool cSVDRPClient::GetRemoteTimers(cStringList &Response)
|
bool cSVDRPClient::GetRemoteTimers(cStringList &Response)
|
||||||
{
|
{
|
||||||
if (HasFetchFlag(sffTimers)) {
|
if (Execute("LSTT ID", &Response)) {
|
||||||
if (Execute("LSTT ID", &Response)) {
|
for (int i = 0; i < Response.Size(); i++) {
|
||||||
for (int i = 0; i < Response.Size(); i++) {
|
char *s = Response[i];
|
||||||
char *s = Response[i];
|
int Code = SVDRPCode(s);
|
||||||
int Code = SVDRPCode(s);
|
if (Code == 250)
|
||||||
if (Code == 250)
|
strshift(s, 4);
|
||||||
strshift(s, 4);
|
else {
|
||||||
else {
|
if (Code != 550)
|
||||||
if (Code != 550)
|
esyslog("ERROR: %s: %s", ServerName(), s);
|
||||||
esyslog("ERROR: %s: %s", ServerName(), s);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Response.SortNumerically();
|
}
|
||||||
return true;
|
Response.SortNumerically();
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -629,18 +627,25 @@ void cSVDRPClientHandler::SendDiscover(void)
|
|||||||
void cSVDRPClientHandler::ProcessConnections(void)
|
void cSVDRPClientHandler::ProcessConnections(void)
|
||||||
{
|
{
|
||||||
cString PollTimersCmd;
|
cString PollTimersCmd;
|
||||||
if (cTimers::GetTimersRead(timersStateKey)) {
|
if (cTimers::GetTimersRead(timersStateKey, 100)) {
|
||||||
PollTimersCmd = cString::sprintf("POLL %s TIMERS", Setup.SVDRPHostName);
|
PollTimersCmd = cString::sprintf("POLL %s TIMERS", Setup.SVDRPHostName);
|
||||||
timersStateKey.Remove();
|
timersStateKey.Remove();
|
||||||
}
|
}
|
||||||
|
else if (timersStateKey.TimedOut())
|
||||||
|
return; // try again next time
|
||||||
for (int i = 0; i < clientConnections.Size(); i++) {
|
for (int i = 0; i < clientConnections.Size(); i++) {
|
||||||
cSVDRPClient *Client = clientConnections[i];
|
cSVDRPClient *Client = clientConnections[i];
|
||||||
if (Client->Process()) {
|
if (Client->Process()) {
|
||||||
cStringList RemoteTimers;
|
if (Client->HasFetchFlag(sffTimers)) {
|
||||||
if (Client->GetRemoteTimers(RemoteTimers)) {
|
cStringList RemoteTimers;
|
||||||
cTimers *Timers = cTimers::GetTimersWrite(timersStateKey);
|
if (Client->GetRemoteTimers(RemoteTimers)) {
|
||||||
bool TimersModified = Timers->StoreRemoteTimers(Client->ServerName(), &RemoteTimers);
|
if (cTimers *Timers = cTimers::GetTimersWrite(timersStateKey, 100)) {
|
||||||
timersStateKey.Remove(TimersModified);
|
bool TimersModified = Timers->StoreRemoteTimers(Client->ServerName(), &RemoteTimers);
|
||||||
|
timersStateKey.Remove(TimersModified);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Client->SetFetchFlag(sffTimers); // try again next time
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (*PollTimersCmd) {
|
if (*PollTimersCmd) {
|
||||||
if (!Client->Execute(PollTimersCmd))
|
if (!Client->Execute(PollTimersCmd))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user