Commit abcea076 authored by Sergey Lyubka's avatar Sergey Lyubka

Fix #373

parent 6a54704b
...@@ -2712,6 +2712,12 @@ size_t mg_websocket_write(struct mg_connection* conn, int opcode, ...@@ -2712,6 +2712,12 @@ size_t mg_websocket_write(struct mg_connection* conn, int opcode,
free(copy); free(copy);
} }
// If we send closing frame, schedule a connection to be closed after
// data is drained to the client.
if (opcode == WEBSOCKET_OPCODE_CONNECTION_CLOSE) {
MG_CONN_2_CONN(conn)->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
}
return MG_CONN_2_CONN(conn)->ns_conn->send_iobuf.len; return MG_CONN_2_CONN(conn)->ns_conn->send_iobuf.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