1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

interop notes - libwebsocket -06 close

... this afternoon I was just doing a little
interoperability testing around close... in my test-server I added

 libwebsocket_close_and_free_session(this, wsi, LWS_CLOSE_STATUS_NORMAL);

in order to generate a server driven close.. I hope that was the right
way to go about it. In any event, in generated an invalid websocket
frame - I think you want this patch, or something like it:

Signed-off-by: \"Pat McManus @Mozilla\" <mcmanus@ducksong.com>
This commit is contained in:
Pat McManus @Mozilla 2011-03-07 06:06:36 +00:00 committed by Andy Green
parent a047d8582d
commit 2a8978feec

View file

@ -1215,9 +1215,11 @@ int libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf,
*/
if (wsi->close_reason) {
buf[pre - 2] = wsi->close_reason >> 8;
buf[pre - 1] = wsi->close_reason;
pre += 2;
/* reason codes count as data bytes */
buf -= 2;
buf[0] = wsi->close_reason >> 8;
buf[1] = wsi->close_reason;
len += 2;
}
break;
}