Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
update: change buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
gaowanlu committed Aug 2, 2023
1 parent 317d1fa commit 055c922
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/app/http_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class html_loader

void http_app::process_connection(tubekit::connection::http_connection &m_http_connection)
{
m_http_connection.m_buffer.set_limit_max(5120);
m_http_connection.m_buffer.set_limit_max(512000);
// load callback
m_http_connection.destory_callback = [](http_connection &m_connection) -> void
{
Expand Down Expand Up @@ -86,9 +86,9 @@ void http_app::process_connection(tubekit::connection::http_connection &m_http_c
// and the response must be set response_end to true, then write after write_end_callback will be continuously recalled
connection.write_end_callback = [](http_connection &m_connection) -> void
{
char buf[2048] = {0};
char buf[204800] = {0};
int len = 0;
len = ::fread(buf, sizeof(char), 2048, (FILE *)m_connection.ptr);
len = ::fread(buf, sizeof(char), 204800, (FILE *)m_connection.ptr);
if (len > 0)
{
m_connection.m_buffer.write(buf, len);
Expand Down
2 changes: 1 addition & 1 deletion src/connection/http_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using namespace std;
using namespace tubekit::connection;

http_connection::http_connection(tubekit::socket::socket *socket_ptr) : m_buffer(2048),
http_connection::http_connection(tubekit::socket::socket *socket_ptr) : m_buffer(204800),
socket_ptr(socket_ptr),
recv_end(false),
process_end(false),
Expand Down
4 changes: 2 additions & 2 deletions src/connection/http_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ namespace tubekit
std::vector<std::vector<char>> chunks;
std::vector<char> data;
buffer::buffer m_buffer;
const size_t buffer_size{2048};
char buffer[2048];
const size_t buffer_size{204800};
char buffer[204800];
int buffer_used_len; // effective content length in buffer
int buffer_start_use;
std::string head_field_tmp;
Expand Down
4 changes: 2 additions & 2 deletions src/connection/stream_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using tubekit::connection::stream_connection;

stream_connection::stream_connection(tubekit::socket::socket *socket_ptr) : socket_ptr(socket_ptr),
m_send_buffer(2048),
m_recv_buffer(2048),
m_send_buffer(204800),
m_recv_buffer(204800),
connection_state(stream_connection::state::RECV)
{
}
Expand Down

0 comments on commit 055c922

Please sign in to comment.