Skip to content

Commit

Permalink
fix(mDNS): OOM fix
Browse files Browse the repository at this point in the history
  • Loading branch information
windowsair committed Feb 26, 2022
1 parent 2257c43 commit c13366d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ESP8266_RTOS_SDK
15 changes: 11 additions & 4 deletions main/DAP_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "main/usbip_server.h"
#include "main/DAP_handle.h"
#include "main/dap_configuration.h"
#include "main/wifi_configuration.h"

#include "components/USBIP/usb_descriptor.h"
#include "components/DAP/include/DAP.h"
Expand All @@ -32,6 +33,12 @@
#include "lwip/sys.h"
#include <lwip/netdb.h>

#if ((USE_MDNS == 1) || (USE_OTA == 1))
#define DAP_BUFFER_NUM 10
#else
#define DAP_BUFFER_NUM 20
#endif

#if (USE_WINUSB == 1)
typedef struct
{
Expand Down Expand Up @@ -141,8 +148,8 @@ void SWO_QueueTransfer(uint8_t *buf, uint32_t num)

void DAP_Thread(void *argument)
{
dap_dataIN_handle = xRingbufferCreate(DAP_HANDLE_SIZE * 20, RINGBUF_TYPE_BYTEBUF);
dap_dataOUT_handle = xRingbufferCreate(DAP_HANDLE_SIZE * 20, RINGBUF_TYPE_BYTEBUF);
dap_dataIN_handle = xRingbufferCreate(DAP_HANDLE_SIZE * DAP_BUFFER_NUM, RINGBUF_TYPE_BYTEBUF);
dap_dataOUT_handle = xRingbufferCreate(DAP_HANDLE_SIZE * DAP_BUFFER_NUM, RINGBUF_TYPE_BYTEBUF);
data_response_mux = xSemaphoreCreateMutex();
size_t packetSize;
int resLength;
Expand All @@ -165,8 +172,8 @@ void DAP_Thread(void *argument)
vRingbufferDelete(dap_dataOUT_handle);
dap_dataIN_handle = dap_dataOUT_handle = NULL;

dap_dataIN_handle = xRingbufferCreate(DAP_HANDLE_SIZE * 20, RINGBUF_TYPE_BYTEBUF);
dap_dataOUT_handle = xRingbufferCreate(DAP_HANDLE_SIZE * 20, RINGBUF_TYPE_BYTEBUF);
dap_dataIN_handle = xRingbufferCreate(DAP_HANDLE_SIZE * DAP_BUFFER_NUM, RINGBUF_TYPE_BYTEBUF);
dap_dataOUT_handle = xRingbufferCreate(DAP_HANDLE_SIZE * DAP_BUFFER_NUM, RINGBUF_TYPE_BYTEBUF);
if (dap_dataIN_handle == NULL || dap_dataIN_handle == NULL)
{
os_printf("Can not create DAP ringbuf/mux!\r\n");
Expand Down

1 comment on commit c13366d

@windowsair
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#31

Please sign in to comment.