in case of short reads, re-align with blocksize
authorFelix Domke <tmbinc@elitedvb.net>
Thu, 24 May 2007 20:09:57 +0000 (20:09 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Thu, 24 May 2007 20:09:57 +0000 (20:09 +0000)
lib/base/filepush.cpp

index 1e5685c..2a894cf 100644 (file)
@@ -174,6 +174,15 @@ void eFilePushThread::thread()
                        }
                        eDebug("eFilePushThread *read error* (%m) - not yet handled");
                }
                        }
                        eDebug("eFilePushThread *read error* (%m) - not yet handled");
                }
+
+                       /* a read might be mis-aligned in case of a short read. */
+               int d = m_buf_end % m_blocksize;
+               if (d)
+               {
+                       m_raw_source.lseek(-d, SEEK_CUR);
+                       m_buf_end -= d;
+               }
+
                if (m_buf_end == 0)
                {
                                /* on EOF, try COMMITting once. */
                if (m_buf_end == 0)
                {
                                /* on EOF, try COMMITting once. */