mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-28 05:39:00 +08:00
Handle #1502 - send CLOSE when CLOSE is received
This commit is contained in:
parent
d11173fe90
commit
2f77855ec1
@ -4996,7 +4996,8 @@ static void mg_ws_cb(struct mg_connection *c, int ev, void *ev_data,
|
||||
case WEBSOCKET_OP_CLOSE:
|
||||
MG_DEBUG(("%lu Got WS CLOSE", c->id));
|
||||
mg_call(c, MG_EV_WS_CTL, &m);
|
||||
c->is_closing = 1;
|
||||
mg_ws_send(c, "", 0, WEBSOCKET_OP_CLOSE);
|
||||
c->is_draining = 1;
|
||||
break;
|
||||
default:
|
||||
// Per RFC6455, close conn when an unknown op is recvd
|
||||
|
3
src/ws.c
3
src/ws.c
@ -174,7 +174,8 @@ static void mg_ws_cb(struct mg_connection *c, int ev, void *ev_data,
|
||||
case WEBSOCKET_OP_CLOSE:
|
||||
MG_DEBUG(("%lu Got WS CLOSE", c->id));
|
||||
mg_call(c, MG_EV_WS_CTL, &m);
|
||||
c->is_closing = 1;
|
||||
mg_ws_send(c, "", 0, WEBSOCKET_OP_CLOSE);
|
||||
c->is_draining = 1;
|
||||
break;
|
||||
default:
|
||||
// Per RFC6455, close conn when an unknown op is recvd
|
||||
|
Loading…
Reference in New Issue
Block a user