[Asterisk-code-review] res http websocket: Increase the buffer size for non-LOW MEM... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Nov 8 04:59:54 CST 2016


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4318 )

Change subject: res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems
......................................................................


res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems

Not surprisingly, using Respoke (and possibly other systems) it is
possible to blow past the 16k limit for a WebSocket packet size. This
patch bumps it up to 32k, which, at least for Respoke, is sufficient.
For now.

Because 32k is laughable on a LOW_MEMORY system (as is 16k, for that
matter), this patch adds a LOW_MEMORY directive that sets the buffer to
8k for systems who have asked for their reduced memory availability to
be considered.

Change-Id: Id235902537091b58608196844dc4b045e383cd2e
---
M res/res_http_websocket.c
1 file changed, 16 insertions(+), 3 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c
index 28bf45f..c1a28f6 100644
--- a/res/res_http_websocket.c
+++ b/res/res_http_websocket.c
@@ -50,16 +50,29 @@
 /*! \brief Number of buckets for registered protocols */
 #define MAX_PROTOCOL_BUCKETS 7
 
+#ifdef LOW_MEMORY
 /*! \brief Size of the pre-determined buffer for WebSocket frames */
-#define MAXIMUM_FRAME_SIZE 16384
+#define MAXIMUM_FRAME_SIZE 8192
 
 /*! \brief Default reconstruction size for multi-frame payload reconstruction. If exceeded the next frame will start a
  *         payload.
  */
-#define DEFAULT_RECONSTRUCTION_CEILING 16384
+#define DEFAULT_RECONSTRUCTION_CEILING 8192
 
 /*! \brief Maximum reconstruction size for multi-frame payload reconstruction. */
-#define MAXIMUM_RECONSTRUCTION_CEILING 16384
+#define MAXIMUM_RECONSTRUCTION_CEILING 8192
+#else
+/*! \brief Size of the pre-determined buffer for WebSocket frames */
+#define MAXIMUM_FRAME_SIZE 32768
+
+/*! \brief Default reconstruction size for multi-frame payload reconstruction. If exceeded the next frame will start a
+ *         payload.
+ */
+#define DEFAULT_RECONSTRUCTION_CEILING 32768
+
+/*! \brief Maximum reconstruction size for multi-frame payload reconstruction. */
+#define MAXIMUM_RECONSTRUCTION_CEILING 32768
+#endif
 
 /*! \brief Maximum size of a websocket frame header
  * 1 byte flags and opcode

-- 
To view, visit https://gerrit.asterisk.org/4318
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id235902537091b58608196844dc4b045e383cd2e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list