refactor: removed updates from article writer

This commit is contained in:
Andrey Prygunkov
2017-09-13 19:19:01 +02:00
parent 8545cb3581
commit 481e7b3d2b
4 changed files with 5 additions and 21 deletions

View File

@@ -2,7 +2,7 @@
* This file is part of nzbget. See <http://nzbget.net>.
*
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
* Copyright (C) 2007-2016 Andrey Prygunkov <hugbug@users.sourceforge.net>
* Copyright (C) 2007-2017 Andrey Prygunkov <hugbug@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,7 +33,6 @@ ArticleDownloader::ArticleDownloader()
{
debug("Creating ArticleDownloader");
m_articleWriter.SetOwner(this);
SetLastUpdateTimeNow();
}

View File

@@ -2,7 +2,7 @@
* This file is part of nzbget. See <http://nzbget.net>.
*
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
* Copyright (C) 2007-2016 Andrey Prygunkov <hugbug@users.sourceforge.net>
* Copyright (C) 2007-2017 Andrey Prygunkov <hugbug@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,16 +56,6 @@ public:
adFatalError
};
class ArticleWriterImpl : public ArticleWriter
{
public:
void SetOwner(ArticleDownloader* owner) { m_owner = owner; }
protected:
virtual void SetLastUpdateTimeNow() { m_owner->SetLastUpdateTimeNow(); }
private:
ArticleDownloader* m_owner;
};
ArticleDownloader();
virtual ~ArticleDownloader();
void SetFileInfo(FileInfo* fileInfo) { m_fileInfo = fileInfo; }
@@ -104,7 +94,7 @@ private:
Decoder::EFormat m_format = Decoder::efUnknown;
YDecoder m_yDecoder;
UDecoder m_uDecoder;
ArticleWriterImpl m_articleWriter;
ArticleWriter m_articleWriter;
ServerStatList m_serverStats;
bool m_writingStarted;
int m_downloadedSize = 0;

View File

@@ -1,7 +1,7 @@
/*
* This file is part of nzbget. See <http://nzbget.net>.
*
* Copyright (C) 2014-2016 Andrey Prygunkov <hugbug@users.sourceforge.net>
* Copyright (C) 2014-2017 Andrey Prygunkov <hugbug@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -417,7 +417,6 @@ void ArticleWriter::CompleteFileParts()
outfile.Seek(pa->GetSegmentOffset());
outfile.Write(pa->GetSegmentContent(), pa->GetSegmentSize());
pa->DiscardSegment();
SetLastUpdateTimeNow();
}
else if (g_Options->GetDecode() && !directWrite)
{
@@ -429,7 +428,6 @@ void ArticleWriter::CompleteFileParts()
{
cnt = (int)infile.Read(buffer, buffer.Size());
outfile.Write(buffer, cnt);
SetLastUpdateTimeNow();
}
infile.Close();
}

View File

@@ -1,7 +1,7 @@
/*
* This file is part of nzbget. See <http://nzbget.net>.
*
* Copyright (C) 2014-2016 Andrey Prygunkov <hugbug@users.sourceforge.net>
* Copyright (C) 2014-2017 Andrey Prygunkov <hugbug@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,9 +60,6 @@ public:
static bool MoveCompletedFiles(NzbInfo* nzbInfo, const char* oldDestDir);
void FlushCache();
protected:
virtual void SetLastUpdateTimeNow() {}
private:
FileInfo* m_fileInfo;
ArticleInfo* m_articleInfo;