Commit ec69bb11 authored by Chen Bill's avatar Chen Bill Committed by GitHub

update buffer size (#2586)

parent 94a1f964
......@@ -100,7 +100,7 @@ void DuelClient::StopClient(bool is_exiting) {
void DuelClient::ClientRead(bufferevent* bev, void* ctx) {
evbuffer* input = bufferevent_get_input(bev);
int len = evbuffer_get_length(input);
unsigned char* duel_client_read = new unsigned char[std::min(len, SIZE_NETWORK_BUFFER)];
unsigned char* duel_client_read = new unsigned char[SIZE_NETWORK_BUFFER];
unsigned short packet_len;
while (len >= 2) {
evbuffer_copyout(input, &packet_len, sizeof packet_len);
......
......@@ -123,7 +123,7 @@ void NetServer::ServerAcceptError(evconnlistener* listener, void* ctx) {
void NetServer::ServerEchoRead(bufferevent *bev, void *ctx) {
evbuffer* input = bufferevent_get_input(bev);
int len = evbuffer_get_length(input);
unsigned char* net_server_read = new unsigned char[std::min(len, SIZE_NETWORK_BUFFER)];
unsigned char* net_server_read = new unsigned char[SIZE_NETWORK_BUFFER];
unsigned short packet_len;
while (len >= 2) {
evbuffer_copyout(input, &packet_len, sizeof packet_len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment