Rename struct mg_connection::label -> data. Make its size configurable

This commit is contained in:
cpq committed 2023-01-10 08:19:49 +00:00
1 parent 3d75d71767
commit da5e8e9778
27 files changed
+3204 -2247

No files matched your search

+2 -2
View File
@@ -10,7 +10,7 @@ static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_HTTP_MSG) {
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
if (mg_http_match_uri(hm, "/api/video1")) {
c->label[0] = 'S'; // Mark that connection as live streamer
c->data[0] = 'S'; // Mark that connection as live streamer
mg_printf(
c, "%s",
"HTTP/1.0 200 OK\r\n"
@@ -36,7 +36,7 @@ static void broadcast_mjpeg_frame(struct mg_mgr *mgr) {
char *data = mg_file_read(&mg_fs_posix, path, &size); // Read next file
struct mg_connection *c;
for (c = mgr->conns; c != NULL; c = c->next) {
if (c->label[0] != 'S') continue; // Skip non-stream connections
if (c->data[0] != 'S') continue; // Skip non-stream connections
if (data == NULL || size == 0) continue; // Skip on file read error
mg_printf(c,
"--foo\r\nContent-Type: image/jpeg\r\n"