diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/filter.c | 29 | ||||
-rw-r--r-- | client/remote.c | 4 | ||||
-rw-r--r-- | client/socket.c | 14 |
3 files changed, 11 insertions, 36 deletions
diff --git a/client/filter.c b/client/filter.c index dad86f3..265276f 100644 --- a/client/filter.c +++ b/client/filter.c @@ -1,5 +1,5 @@ /* - * $Id: filter.c,v 1.1 2004/12/30 22:44:04 lordjaxom Exp $ + * $Id: filter.c,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ */ #include "client/filter.h" @@ -82,32 +82,9 @@ cStreamdevFilter *cStreamdevFilters::Matches(u_short Pid, u_char Tid) { } void cStreamdevFilters::Put(const uchar *Data) { - static time_t firsterr = 0; - static int errcnt = 0; - static bool showerr = true; - int p = m_RingBuffer->Put(Data, TS_SIZE); - if (p != TS_SIZE) { - ++errcnt; - if (showerr) { - if (firsterr == 0) - firsterr = time_ms(); - else if (firsterr + BUFOVERTIME > time_ms() && errcnt > BUFOVERCOUNT) { - esyslog("ERROR: too many buffer overflows, logging stopped"); - showerr = false; - firsterr = time_ms(); - } - } else if (firsterr + BUFOVERTIME < time_ms()) { - showerr = true; - firsterr = 0; - errcnt = 0; - } - - if (showerr) - esyslog("ERROR: ring buffer overflow (%d bytes dropped)", TS_SIZE - p); - else - firsterr = time_ms(); - } + if (p != TS_SIZE) + m_RingBuffer->ReportOverflow(TS_SIZE - p); } void cStreamdevFilters::Action(void) { diff --git a/client/remote.c b/client/remote.c index 4cc7cfe..8463709 100644 --- a/client/remote.c +++ b/client/remote.c @@ -1,5 +1,5 @@ /* - * $Id: remote.c,v 1.1 2004/12/30 22:44:02 lordjaxom Exp $ + * $Id: remote.c,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ */ #include "client/remote.h" @@ -457,7 +457,7 @@ const char *cRemoteTimer::ToText(void) { summary = strreplace(strdup(m_Summary), ':', '|'); asprintf(&m_Buffer, "%d:%s:%s:%04d:%04d:%d:%d:%s:%s", m_Active, - Channel()->GetChannelID().ToString(), PrintDay(m_Day, m_FirstDay), + (const char*)Channel()->GetChannelID().ToString(), PrintDay(m_Day, m_FirstDay), m_Start, m_Stop, m_Priority, m_Lifetime, m_File, summary ? summary : ""); if (summary != NULL) diff --git a/client/socket.c b/client/socket.c index 44af8db..9e399cb 100644 --- a/client/socket.c +++ b/client/socket.c @@ -1,5 +1,5 @@ /* - * $Id: socket.c,v 1.1 2004/12/30 22:44:04 lordjaxom Exp $ + * $Id: socket.c,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ */ #include <tools/select.h> @@ -39,15 +39,12 @@ cTBSocket *cClientSocket::DataSocket(eSocketId Id) const { bool cClientSocket::Command(const cTBString &Command, uint Expected, uint TimeoutMs) { - cTBString pkt; - time_t st; - errno = 0; - pkt = Command + "\015\012"; + cTBString pkt = Command + "\015\012"; Dprintf("OUT: |%s|\n", (const char*)Command); - st = time_ms(); + cTimeMs starttime; if (!TimedWrite((const char*)pkt, pkt.Length(), TimeoutMs)) { esyslog("Streamdev: Lost connection to %s:%d: %s", (const char*)RemoteIp(), RemotePort(), strerror(errno)); @@ -55,8 +52,9 @@ bool cClientSocket::Command(const cTBString &Command, uint Expected, return false; } - if (Expected != 0) { - TimeoutMs -= time_ms() - st; + uint64 elapsed = starttime.Elapsed(); + if (Expected != 0) { // XXX+ What if elapsed > TimeoutMs? + TimeoutMs -= elapsed; return Expect(Expected, NULL, TimeoutMs); } |