- first adoptions (transfer-commit)

This commit is contained in:
lordjaxom
2005-02-08 13:59:16 +00:00
parent 04a5985dcc
commit 8e4556b0a9
14 changed files with 76 additions and 163 deletions

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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);
}