fragge able to send chunks larger than rx buffer 01/3101/1
authorAndy Green <andy.green@linaro.org>
Thu, 14 Feb 2013 06:15:58 +0000 (14:15 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:35 +0000 (13:01 -0800)
This now exercises the code for dealing with rx that spills over
the rx buffer.  Single fraggle uses the default rx buffer size
of 4096, it also now exercises code around that.

Signed-off-by: Andy Green <andy.green@linaro.org>
test-server/test-fraggle.c

index 61f868a..7c0bc1b 100644 (file)
@@ -62,7 +62,7 @@ callback_fraggle(struct libwebsocket_context *context,
                                               void *user, void *in, size_t len)
 {
        int n;
-       unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 2048 +
+       unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 8000 +
                                                  LWS_SEND_BUFFER_POST_PADDING];
        struct per_session_data__fraggle *psf = user;
        int chunk;
@@ -151,7 +151,13 @@ callback_fraggle(struct libwebsocket_context *context,
 
                case FRAGSTATE_RANDOM_PAYLOAD:
 
-                       chunk = (random() % 2000) + 1;
+                       /*
+                        * note how one chunk can be 8000, but we use the
+                        * default rx buffer size of 4096, so we exercise the
+                        * code for rx spill because the rx buffer is full
+                        */
+
+                       chunk = (random() % 8000) + 1;
                        psf->total_message += chunk;
 
                        libwebsockets_get_random(context, bp, chunk);