]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Increase WebSocket frame size and improve large read handling
authorDavid M. Lee <dlee@digium.com>
Wed, 25 Feb 2015 20:44:51 +0000 (20:44 +0000)
committerDavid M. Lee <dlee@digium.com>
Wed, 25 Feb 2015 20:44:51 +0000 (20:44 +0000)
commit43a3e80be155dc7569a94082a1d1c1484cf40dbe
treedd96fe7a09f8a0f4899c5398f9e5c8a6b261b6cd
parent978649a56838c7502a5869b93c697a7c66e5921e
Increase WebSocket frame size and improve large read handling

Some WebSocket applications, like [chan_respoke][], require a larger
frame size than the default 8k; this patch bumps the default to 16k.
This patch also fixes some problems exacerbated by large frames.

The sanity counter was decremented on every fread attempt in
ws_safe_read(), regardless of whether data was read from the socket or
not. For large frames, this could result in loss of sanity prior to
reading the entire frame. (16k frame / 1448 bytes per segment = 12
segments).

This patch changes the sanity counter so that it only decrements when
fread() doesn't read any bytes. This more closely matches the original
intention of ws_safe_read(), given that the error message is
"Websocket seems unresponsive".

This patch also properly logs EOF conditions, so disconnects are no
longer confused with unresponsive connections.

 [chan_respoke]: https://github.com/respoke/chan_respoke

Review: https://reviewboard.asterisk.org/r/4431/
........

Merged revisions 432236 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
res/res_http_websocket.c