git-svn-id: svn://db.shs.com.ru/pip@180 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -359,6 +359,7 @@ bool PIBinaryLog::checkFileHeader() {
|
||||
|
||||
|
||||
PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
||||
logmutex.lock();
|
||||
PIByteArray ba;
|
||||
BinLogRecord br;
|
||||
lastrecord.id = 0;
|
||||
@@ -369,6 +370,7 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
||||
ba >> br.id >> br.size >> br.timestamp;
|
||||
} else {
|
||||
br.id = -1;
|
||||
logmutex.unlock();
|
||||
return br;
|
||||
}
|
||||
if (br.id > 0 && br.size > 0) {
|
||||
@@ -379,6 +381,7 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
||||
lastrecord = br;
|
||||
if (br.id == 0) fileError();
|
||||
moveIndex(index_pos.value(file.pos(), -1));
|
||||
logmutex.unlock();
|
||||
return br;
|
||||
}
|
||||
|
||||
@@ -497,12 +500,14 @@ bool PIBinaryLog::createIndex() {
|
||||
|
||||
|
||||
void PIBinaryLog::seekTo(int rindex) {
|
||||
logmutex.lock();
|
||||
if (rindex < index.size_s() && rindex >= 0) {
|
||||
file.seek(index[rindex].pos);
|
||||
moveIndex(index_pos.value(file.pos(), -1));
|
||||
play_time = index[rindex].timestamp.toMilliseconds();
|
||||
lastrecord.timestamp = index[rindex].timestamp;
|
||||
}
|
||||
logmutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -293,6 +293,7 @@ private:
|
||||
PIFile file;
|
||||
BinLogRecord lastrecord;
|
||||
PISystemTime startlogtime, play_delay, split_time;
|
||||
PIMutex logmutex;
|
||||
double play_time, play_speed;
|
||||
llong split_size;
|
||||
int write_count, split_count, default_id, current_index;
|
||||
|
||||
Reference in New Issue
Block a user