Fix newly introduced crash in the Brynet backend.

This commit is contained in:
Relintai 2021-07-06 20:15:36 +02:00
parent 5c2d97ebbb
commit a16222e29e
3 changed files with 7 additions and 7 deletions

View File

@ -9,18 +9,18 @@ void BryRequest::send() {
//} //}
if (http_parser->isKeepAlive()) { if (http_parser->isKeepAlive()) {
response->addHeadValue("Connection", "Keep-Alive");
response->setBody(compiled_body); response->setBody(compiled_body);
response->addHeadValue("Connection", "Keep-Alive");
std::string result = response->getResult(); std::string result = response->getResult();
session->send(result.c_str(), result.size()); session->send(result.c_str(), result.size());
} else { } else {
response->addHeadValue("Connection", "Close");
response->setBody(compiled_body); response->setBody(compiled_body);
response->addHeadValue("Connection", "Close");
std::string result = response->getResult(); std::string result = response->getResult();
HttpSession::Ptr lsession = session; HttpSession::Ptr lsession = session;
@ -102,6 +102,8 @@ void BryRequest::pool() {
BryRequest::BryRequest() : BryRequest::BryRequest() :
Request() { Request() {
response = nullptr; response = nullptr;
reset();
} }
BryRequest::~BryRequest() { BryRequest::~BryRequest() {

View File

@ -162,8 +162,6 @@ Request::Request() {
//It is a tradeoff on server memory though, as every active download will consume this amount of memory //It is a tradeoff on server memory though, as every active download will consume this amount of memory
//where the file is bigger than this number //where the file is bigger than this number
file_chunk_size = 1 << 21; //2MB file_chunk_size = 1 << 21; //2MB
reset();
} }
Request::~Request() { Request::~Request() {

View File

@ -83,7 +83,7 @@ void DRequest::pool() {
DRequest::pool(this); DRequest::pool(this);
} }
DRequest::DRequest() { DRequest::DRequest() : Request() {
//This value will need benchmarks, 2 MB seems to be just as fast for me as 4 MB, but 1MB is slower //This value will need benchmarks, 2 MB seems to be just as fast for me as 4 MB, but 1MB is slower
//It is a tradeoff on server memory though, as every active download will consume this amount of memory //It is a tradeoff on server memory though, as every active download will consume this amount of memory