From 15b483ba80d4d0d40ff46dcb3e08cec48c352fae Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 8 Jul 2023 17:12:37 +0800 Subject: [PATCH] fix bug --- src/engine/server/ddncq.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/engine/server/ddncq.cpp b/src/engine/server/ddncq.cpp index ecd959b..f710905 100644 --- a/src/engine/server/ddncq.cpp +++ b/src/engine/server/ddncq.cpp @@ -4,6 +4,7 @@ std::vector websockets; DDNetCQ* DDNetCQ::instance=nullptr; DDNetCQ* const ddncq=DDNetCQ::GetInstance(); #define MAX_PLAYLOAD_LEN 10*1024 +unsigned char msg[8196]=""; int WebSocketListener( struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len ) { switch (reason){ case LWS_CALLBACK_ESTABLISHED: @@ -12,11 +13,9 @@ int WebSocketListener( struct lws *wsi, enum lws_callback_reasons reason, void * break; case LWS_CALLBACK_RECEIVE: { - unsigned char* msg=new uint8_t[8192]; memset(msg,0,sizeof(msg)); memcpy(msg,in,len); ddncq->gamectx->SendChat(-1,CGameContext::CHAT_ALL,(const char*)msg); - delete[] msg; } break; case LWS_CALLBACK_CLOSED: