git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
translate some things
[enigma2.git]
/
lib
/
base
/
filepush.cpp
diff --git
a/lib/base/filepush.cpp
b/lib/base/filepush.cpp
index a955e10b20e952f239d00690f6dcb3dded9208fc..51b262395633f64954a8f50f2a0bf755a5830504 100644
(file)
--- a/
lib/base/filepush.cpp
+++ b/
lib/base/filepush.cpp
@@
-27,6
+27,8
@@
void eFilePushThread::thread()
off_t current_span_offset = 0;
size_t current_span_remaining = 0;
off_t current_span_offset = 0;
size_t current_span_remaining = 0;
+ size_t written_since_last_sync = 0;
+
int already_empty = 0;
eDebug("FILEPUSH THREAD START");
// this is a race. FIXME.
int already_empty = 0;
eDebug("FILEPUSH THREAD START");
// this is a race. FIXME.
@@
-47,6
+49,7
@@
void eFilePushThread::thread()
if (m_buf_start != m_buf_end)
{
// TODO: take care of boundaries.
if (m_buf_start != m_buf_end)
{
// TODO: take care of boundaries.
+ filterRecordData(m_buffer + m_buf_start, m_buf_end - m_buf_start);
int w = write(m_fd_dest, m_buffer + m_buf_start, m_buf_end - m_buf_start);
// eDebug("wrote %d bytes", w);
if (w <= 0)
int w = write(m_fd_dest, m_buffer + m_buf_start, m_buf_end - m_buf_start);
// eDebug("wrote %d bytes", w);
if (w <= 0)
@@
-59,8
+62,16
@@
void eFilePushThread::thread()
/* this should flush all written pages to disk. */
posix_fadvise(m_fd_dest, dest_pos, w, POSIX_FADV_DONTNEED);
/* this should flush all written pages to disk. */
posix_fadvise(m_fd_dest, dest_pos, w, POSIX_FADV_DONTNEED);
-
+
dest_pos += w;
dest_pos += w;
+ written_since_last_sync += w;
+
+ if (written_since_last_sync >= 512*1024)
+ {
+ fdatasync(m_fd_dest);
+ written_since_last_sync = 0;
+ }
+
// printf("FILEPUSH: wrote %d bytes\n", w);
m_buf_start += w;
continue;
// printf("FILEPUSH: wrote %d bytes\n", w);
m_buf_start += w;
continue;
@@
-94,7
+105,12
@@
void eFilePushThread::thread()
m_buf_end = 0;
if (errno == EINTR)
continue;
m_buf_end = 0;
if (errno == EINTR)
continue;
- eDebug("eFilePushThread *read error* - not yet handled");
+ if (errno == EOVERFLOW)
+ {
+ eWarning("OVERFLOW while recording");
+ continue;
+ }
+ eDebug("eFilePushThread *read error* (%m) - not yet handled");
}
if (m_buf_end == 0)
{
}
if (m_buf_end == 0)
{
@@
-189,3
+205,9
@@
void eFilePushThread::recvEvent(const int &evt)
{
m_event(evt);
}
{
m_event(evt);
}
+
+void eFilePushThread::filterRecordData(const unsigned char *data, int len)
+{
+ /* do nothing */
+}
+