From 9fc50b5a403a49ab7dd308248b7f60be2a19ec9e Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 14 Feb 2013 14:15:58 +0800 Subject: [PATCH] fragge able to send chunks larger than rx buffer 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 --- test-server/test-fraggle.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test-server/test-fraggle.c b/test-server/test-fraggle.c index 61f868a..7c0bc1b 100644 --- a/test-server/test-fraggle.c +++ b/test-server/test-fraggle.c @@ -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); -- 2.7.4