Add a cap to mg_dash_send_change()

This commit is contained in:
cpq
2026-08-27 09:43:56 +01:00
parent 897d26edfb
commit e7cfaa70c7
2 changed files with 22 additions and 0 deletions
+17
View File
@@ -1145,6 +1145,11 @@ void mg_dash_send_change(struct mg_mgr *mgr, struct mg_field_set *set) {
struct mg_dash_cdata *d;
struct mg_dash_user *u;
if (!c->is_websocket) continue;
if (c->send.len > MG_DASH_MAX_SEND_BUF_SIZE) { // Skip slow consumers
MG_ERROR(("skipping, send buf %lu > %d", (unsigned long) c->send.len,
MG_DASH_MAX_SEND_BUF_SIZE));
continue;
}
d = (struct mg_dash_cdata *) c->data;
u = d->u;
if (u == NULL) continue;
@@ -3592,6 +3597,18 @@ static bool p_mkdir(const char *path) {
struct mg_fs mg_fs_posix = {p_stat, p_list, p_open, p_close, p_read,
p_write, p_seek, p_rename, p_remove, p_mkdir};
#ifdef MG_ENABLE_LINES
#line 1 "src/health.c"
#endif
// The one health record. Lives in RAM that survives a warm reset, see
// MG_HEALTH_RAM and the .mg_health region in the linker script
struct mg_health mg_health_record MG_HEALTH_RAM;
// Next ms tick at which mg_health_uptime() increments the record's uptime
uint64_t mg_health_next_ms;
#ifdef MG_ENABLE_LINES
#line 1 "src/http.c"
#endif
+5
View File
@@ -170,6 +170,11 @@ void mg_dash_send_change(struct mg_mgr *mgr, struct mg_field_set *set) {
struct mg_dash_cdata *d;
struct mg_dash_user *u;
if (!c->is_websocket) continue;
if (c->send.len > MG_DASH_MAX_SEND_BUF_SIZE) { // Skip slow consumers
MG_ERROR(("skipping, send buf %lu > %d", (unsigned long) c->send.len,
MG_DASH_MAX_SEND_BUF_SIZE));
continue;
}
d = (struct mg_dash_cdata *) c->data;
u = d->u;
if (u == NULL) continue;