summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmirl <schmirl>2007-01-15 11:41:46 +0000
committerschmirl <schmirl>2007-01-15 11:41:46 +0000
commit56571d5879cf734770194ea975416883a5007cc5 (patch)
tree8e58849a91e2067d20efab4b95d506ec8b029daa
parentab342d37b3210e98936aa2630791f2143ddaeb3a (diff)
downloadvdr-plugin-streamdev-56571d5879cf734770194ea975416883a5007cc5.tar.gz
vdr-plugin-streamdev-56571d5879cf734770194ea975416883a5007cc5.tar.bz2
Log throttle for connection failure messages (#183)
-rw-r--r--client/socket.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/client/socket.c b/client/socket.c
index d814d9d..40772d6 100644
--- a/client/socket.c
+++ b/client/socket.c
@@ -1,5 +1,5 @@
/*
- * $Id: socket.c,v 1.5 2007/01/15 11:36:37 schmirl Exp $
+ * $Id: socket.c,v 1.6 2007/01/15 11:41:46 schmirl Exp $
*/
#include <tools/select.h>
@@ -7,6 +7,9 @@
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
+#include <time.h>
+
+#define MINLOGREPEAT 10 //don't log connect failures too often (seconds)
#include "client/socket.h"
#include "client/setup.h"
@@ -111,9 +114,13 @@ bool cClientSocket::CheckConnection(void) {
}
if (!Connect(StreamdevClientSetup.RemoteIp, StreamdevClientSetup.RemotePort)){
- esyslog("ERROR: Streamdev: Couldn't connect to %s:%d: %s",
+ static time_t lastTime = 0;
+ if (time(NULL) - lastTime > MINLOGREPEAT) {
+ esyslog("ERROR: Streamdev: Couldn't connect to %s:%d: %s",
(const char*)StreamdevClientSetup.RemoteIp,
StreamdevClientSetup.RemotePort, strerror(errno));
+ lastTime = time(NULL);
+ }
return false;
}