Fix #1334 - typo in mg_call(..MG_EV_WS_OPEN) call

This commit is contained in:
Sergey Lyubka committed 2021-08-11 04:52:39 +01:00
1 parent b739aa89f1
commit 8b770d2a0d
3 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -4687,7 +4687,7 @@ void mg_ws_upgrade(struct mg_connection *c, struct mg_http_message *hm,
ws_handshake(c, wskey, wsproto, fmt, ap); ws_handshake(c, wskey, wsproto, fmt, ap);
va_end(ap); va_end(ap);
c->is_websocket = 1; c->is_websocket = 1;
mg_call(c, MG_EV_WS_OPEN, &hm); mg_call(c, MG_EV_WS_OPEN, hm);
} }
} }
+1 -1
View File
@@ -233,7 +233,7 @@ void mg_ws_upgrade(struct mg_connection *c, struct mg_http_message *hm,
ws_handshake(c, wskey, wsproto, fmt, ap); ws_handshake(c, wskey, wsproto, fmt, ap);
va_end(ap); va_end(ap);
c->is_websocket = 1; c->is_websocket = 1;
mg_call(c, MG_EV_WS_OPEN, &hm); mg_call(c, MG_EV_WS_OPEN, hm);
} }
} }
+2
View File
@@ -378,6 +378,8 @@ static void eh1(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
mg_http_serve_dir(c, hm, &sopts); mg_http_serve_dir(c, hm, &sopts);
} }
} else if (ev == MG_EV_WS_OPEN) { } else if (ev == MG_EV_WS_OPEN) {
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
ASSERT(mg_strcmp(hm->uri, mg_str("/ws")) == 0);
mg_ws_send(c, "opened", 6, WEBSOCKET_OP_BINARY); mg_ws_send(c, "opened", 6, WEBSOCKET_OP_BINARY);
} else if (ev == MG_EV_WS_MSG) { } else if (ev == MG_EV_WS_MSG) {
struct mg_ws_message *wm = (struct mg_ws_message *) ev_data; struct mg_ws_message *wm = (struct mg_ws_message *) ev_data;