Commit c198d2e5 authored by Бобби's avatar Бобби Committed by Cesanta Bot

Make MG_CTL_MSG_MESSAGE_SIZE overridable

CL: Make MG_CTL_MSG_MESSAGE_SIZE overridable

Fix https://github.com/cesanta/mongoose/pull/987

PUBLISHED_FROM=b0a7c67297b98f616c9eadcd3c34b8747939c918
parent 9a70abef
...@@ -16,5 +16,5 @@ that can be, and must be, called from a different (non-IO) thread. ...@@ -16,5 +16,5 @@ that can be, and must be, called from a different (non-IO) thread.
`func` callback function will be called by the IO thread for each `func` callback function will be called by the IO thread for each
connection. When called, the event will be `MG_EV_POLL`, and a message will connection. When called, the event will be `MG_EV_POLL`, and a message will
be passed as the `ev_data` pointer. Maximum message size is capped be passed as the `ev_data` pointer. Maximum message size is capped
by `MG_CTL_MSG_MESSAGE_SIZE` which is set to 8192 bytes. by `MG_CTL_MSG_MESSAGE_SIZE` which is set to 8192 bytes by default.
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
/* Amalgamated: #include "mg_http.h" */ /* Amalgamated: #include "mg_http.h" */
/* Amalgamated: #include "mg_net.h" */ /* Amalgamated: #include "mg_net.h" */
#ifndef MG_CTL_MSG_MESSAGE_SIZE
#define MG_CTL_MSG_MESSAGE_SIZE 8192 #define MG_CTL_MSG_MESSAGE_SIZE 8192
#endif
/* internals that need to be accessible in unit tests */ /* internals that need to be accessible in unit tests */
MG_INTERNAL struct mg_connection *mg_do_connect(struct mg_connection *nc, MG_INTERNAL struct mg_connection *mg_do_connect(struct mg_connection *nc,
......
...@@ -4034,7 +4034,7 @@ int mg_mgr_poll(struct mg_mgr *mgr, int milli); ...@@ -4034,7 +4034,7 @@ int mg_mgr_poll(struct mg_mgr *mgr, int milli);
* `func` callback function will be called by the IO thread for each * `func` callback function will be called by the IO thread for each
* connection. When called, the event will be `MG_EV_POLL`, and a message will * connection. When called, the event will be `MG_EV_POLL`, and a message will
* be passed as the `ev_data` pointer. Maximum message size is capped * be passed as the `ev_data` pointer. Maximum message size is capped
* by `MG_CTL_MSG_MESSAGE_SIZE` which is set to 8192 bytes. * by `MG_CTL_MSG_MESSAGE_SIZE` which is set to 8192 bytes by default.
*/ */
void mg_broadcast(struct mg_mgr *mgr, mg_event_handler_t cb, void *data, void mg_broadcast(struct mg_mgr *mgr, mg_event_handler_t cb, void *data,
size_t len); size_t len);
......
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
#include "mg_http.h" #include "mg_http.h"
#include "mg_net.h" #include "mg_net.h"
#ifndef MG_CTL_MSG_MESSAGE_SIZE
#define MG_CTL_MSG_MESSAGE_SIZE 8192 #define MG_CTL_MSG_MESSAGE_SIZE 8192
#endif
/* internals that need to be accessible in unit tests */ /* internals that need to be accessible in unit tests */
MG_INTERNAL struct mg_connection *mg_do_connect(struct mg_connection *nc, MG_INTERNAL struct mg_connection *mg_do_connect(struct mg_connection *nc,
......
...@@ -225,7 +225,7 @@ int mg_mgr_poll(struct mg_mgr *mgr, int milli); ...@@ -225,7 +225,7 @@ int mg_mgr_poll(struct mg_mgr *mgr, int milli);
* `func` callback function will be called by the IO thread for each * `func` callback function will be called by the IO thread for each
* connection. When called, the event will be `MG_EV_POLL`, and a message will * connection. When called, the event will be `MG_EV_POLL`, and a message will
* be passed as the `ev_data` pointer. Maximum message size is capped * be passed as the `ev_data` pointer. Maximum message size is capped
* by `MG_CTL_MSG_MESSAGE_SIZE` which is set to 8192 bytes. * by `MG_CTL_MSG_MESSAGE_SIZE` which is set to 8192 bytes by default.
*/ */
void mg_broadcast(struct mg_mgr *mgr, mg_event_handler_t cb, void *data, void mg_broadcast(struct mg_mgr *mgr, mg_event_handler_t cb, void *data,
size_t len); size_t 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