+#include <config.h>
#include <lib/base/filepush.h>
#include <lib/base/eerror.h>
#include <errno.h>
eFilePushThread::eFilePushThread()
{
m_stop = 0;
- m_buf_start = m_buf_end = 0;
+ flush();
}
static void signal_handler(int x)
{
// TODO: take care of boundaries.
int w = write(m_fd_dest, m_buffer + m_buf_start, m_buf_end - m_buf_start);
- eDebug("wrote %d bytes", w);
+// eDebug("wrote %d bytes", w);
if (w <= 0)
{
if (errno == -EINTR)
continue;
- eDebug("eFilePushThread *write error* - not yet handled");
+ eDebug("eFilePushThread *write error* (%m) - not yet handled");
// ... we would stop the thread
}
stop();
}
-void eFilePushThread::seek(off_t where)
+void eFilePushThread::seek(int whence, off_t where)
{
- ::lseek(m_fd_source, where, SEEK_SET);
+ ::lseek(m_fd_source, where, whence);
}
void eFilePushThread::resume()
m_stop = 0;
run();
}
+
+void eFilePushThread::flush()
+{
+ m_buf_start = m_buf_end = 0;
+}
+