git-svn-id: svn://db.shs.com.ru/pip@260 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-09-08 04:59:52 +00:00
parent 3983ee1648
commit a37211aad3
6 changed files with 26 additions and 3 deletions

View File

@@ -80,6 +80,16 @@ bool PIBinaryLog::openDevice() {
if (path().isEmpty() && mode_ == WriteOnly) {
setPath(getLogfilePath());
}
if (path().isEmpty() && mode_ == ReadOnly) {
PIDir ld(logDir());
if (ld.isExists()) {
PIVector<PIFile::FileInfo> es = ld.allEntries();
piForeachC(PIFile::FileInfo &i, es) {
if (i.extension() == "binlog" && i.isFile())
setPath(i.path);
}
}
}
if (!file.open(path(), mode_)) {
piCoutObj << "Error: Can't open file" << path();
return false;
@@ -129,6 +139,8 @@ bool PIBinaryLog::closeDevice() {
bool PIBinaryLog::threadedRead(uchar *readed, int size) {
// piCout << "binlog threaded read";
if (!canRead() || isEnd()) return PIIODevice::threadedRead(readed, size);
is_thread_ok = false;
PISystemTime pt;
double delay;
@@ -136,6 +148,8 @@ bool PIBinaryLog::threadedRead(uchar *readed, int size) {
case PlayRealTime:
pt = PISystemTime::current() - startlogtime;
if (is_started) {
if ((lastrecord.timestamp - pt).toSeconds() > 100. || (lastrecord.timestamp - pt).toSeconds() < -100.)
piCoutObj << PISystemTime::current() << startlogtime << pt << lastrecord.timestamp << (lastrecord.timestamp - pt);
if (lastrecord.timestamp > pt)
(lastrecord.timestamp - pt).sleep();
} else {