Skip to content

Commit

Permalink
Add config option for the read buffer size of the NNTP connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Batunga committed Jan 5, 2023
1 parent 942f8a7 commit bfc68a4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions daemon/main/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ static const char* OPTION_QUOTASTARTDAY = "QuotaStartDay";
static const char* OPTION_DAILYQUOTA = "DailyQuota";
static const char* OPTION_REORDERFILES = "ReorderFiles";
static const char* OPTION_UPDATECHECK = "UpdateCheck";
static const char* OPTION_CONNECTIONREADBUFFER = "ConnectionReadBuffer";

// obsolete options
static const char* OPTION_POSTLOGKIND = "PostLogKind";
Expand Down Expand Up @@ -525,6 +526,7 @@ void Options::InitDefaults()
SetOption(OPTION_DAILYQUOTA, "0");
SetOption(OPTION_REORDERFILES, "no");
SetOption(OPTION_UPDATECHECK, "none");
SetOption(OPTION_CONNECTIONREADBUFFER, "4");
}

void Options::InitOptFile()
Expand Down Expand Up @@ -728,6 +730,7 @@ void Options::InitOptions()
m_monthlyQuota = ParseIntValue(OPTION_MONTHLYQUOTA, 10);
m_quotaStartDay = ParseIntValue(OPTION_QUOTASTARTDAY, 10);
m_dailyQuota = ParseIntValue(OPTION_DAILYQUOTA, 10);
m_connectionReadBuffer = ParseIntValue(OPTION_CONNECTIONREADBUFFER, 10) * 1024;

m_nzbLog = (bool)ParseEnumValue(OPTION_NZBLOG, BoolCount, BoolNames, BoolValues);
m_appendCategoryDir = (bool)ParseEnumValue(OPTION_APPENDCATEGORYDIR, BoolCount, BoolNames, BoolValues);
Expand Down
3 changes: 3 additions & 0 deletions daemon/main/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ class Options
Categories* GetCategories() { return &m_categories; }
Category* FindCategory(const char* name, bool searchAliases) { return m_categories.FindCategory(name, searchAliases); }

int GetConnectionReadBuffer() { return m_connectionReadBuffer; }

// Current state
void SetServerMode(bool serverMode) { m_serverMode = serverMode; }
bool GetServerMode() { return m_serverMode; }
Expand Down Expand Up @@ -434,6 +436,7 @@ class Options
bool m_reorderFiles = false;
EFileNaming m_fileNaming = nfArticle;
int m_downloadRate = 0;
int m_connectionReadBuffer = 0;

// Application mode
bool m_serverMode = false;
Expand Down
2 changes: 1 addition & 1 deletion daemon/nntp/ArticleDownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ ArticleDownloader::EStatus ArticleDownloader::Download()
m_decoder.SetRawMode(g_Options->GetRawArticle());

status = adRunning;
CharBuffer lineBuf(1024*4);
CharBuffer lineBuf(g_Options->GetConnectionReadBuffer());

while (!IsStopped() && !m_decoder.GetEof())
{
Expand Down
4 changes: 4 additions & 0 deletions nzbget.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,10 @@ QuotaStartDay=1
DailyQuota=0


# Readbuffer size for the connections to the news server (kilobytes).
ConnectionReadBuffer=4


##############################################################################
### LOGGING ###

Expand Down

0 comments on commit bfc68a4

Please sign in to comment.