优化http服务器和客户端内存占用

This commit is contained in:
xiongziliang
2019-04-23 12:22:59 +08:00
parent 74621618ff
commit 5dfb7663e4
2 changed files with 10 additions and 5 deletions

View File

@@ -186,7 +186,7 @@ int64_t HttpClient::onRecvHeader(const char *data, uint64_t len) {
//所以返回-1代表我们接下来分段接收content
_recvedBodySize = 0;
//根据_totalBodySize设置接收缓存大小
_sock->setReadBuffer(std::make_shared<BufferRaw>(MAX(_totalBodySize + 1,256 * 1024)));
_sock->setReadBuffer(std::make_shared<BufferRaw>(MIN(_totalBodySize + 1,256 * 1024)));
return -1;
}