diff options
author | Frank Schmirler <vdr@schmirler.de> | 2011-04-11 13:56:49 +0200 |
---|---|---|
committer | Frank Schmirler <vdr@schmirler.de> | 2011-04-11 13:56:49 +0200 |
commit | 19e8cf2a286bb56c0b10eb12859c8c5feeff8ce9 (patch) | |
tree | b9b0aa627bcb678a3aa82171ff4c94e28422ccab /server | |
parent | 17bb6390f9883a1f029ffe4caaa4cc130fcb8b7a (diff) | |
download | vdr-plugin-streamdev-19e8cf2a286bb56c0b10eb12859c8c5feeff8ce9.tar.gz vdr-plugin-streamdev-19e8cf2a286bb56c0b10eb12859c8c5feeff8ce9.tar.bz2 |
writer must not spend too much time waiting in select() without checking
if the thread has been cancelled.
Delayed the streamdev main thread for up to 3 seconds. As the command timeou
of VTP connections is 1.5 seconds, one hanging connection could have caused
VTP connections to die.
Diffstat (limited to 'server')
-rw-r--r-- | server/streamer.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/streamer.c b/server/streamer.c index ec7d3c3..3ae513d 100644 --- a/server/streamer.c +++ b/server/streamer.c @@ -45,6 +45,7 @@ void cStreamdevWriter::Action(void) int max = 0; uchar *block = NULL; int count, offset = 0; + int timeout = 0; #if APIVERSNUM >= 10705 SetPriority(-3); @@ -58,10 +59,13 @@ void cStreamdevWriter::Action(void) } if (block != NULL) { - if (sel.Select(15000) == -1) { + if (sel.Select(600) == -1) { + if (errno == ETIMEDOUT && timeout++ < 20) + continue; // still Running()? esyslog("ERROR: streamdev-server: couldn't send data: %m"); break; } + timeout = 0; if (sel.CanWrite(*m_Socket)) { int written; |