aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorDave Barach <dbarach@cisco.com>2017-03-28 12:31:33 -0400
committerFlorin Coras <florin.coras@gmail.com>2017-03-28 20:37:47 +0000
commit45ce3fbee5c1a7ad2a01f766c9b05059aa467b8f (patch)
tree11931328d2e800793a0e2cc14b6195b38166e0b2 /src/vnet/tcp
parentd7f75cdf672ff1b323175a50b853d63c1242e65c (diff)
Unscrew builtin client
"test tcp client bytes 750000" deadlocks w/ Pr={1.0} Change-Id: Ifa56b0de7812b9f27aa5bce2874b740c46ab30bd Signed-off-by: Dave Barach <dbarach@cisco.com>
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/builtin_client.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vnet/tcp/builtin_client.c b/src/vnet/tcp/builtin_client.c
index a6eeb775dea..83cdbc1be6d 100644
--- a/src/vnet/tcp/builtin_client.c
+++ b/src/vnet/tcp/builtin_client.c
@@ -47,7 +47,7 @@ static void
send_test_chunk (tclient_main_t * tm, session_t * s)
{
u8 *test_data = tm->connect_test_data;
- int test_buf_offset = 0;
+ int test_buf_offset;
u32 bytes_this_chunk;
session_fifo_event_t evt;
static int serial_number = 0;
@@ -55,8 +55,12 @@ send_test_chunk (tclient_main_t * tm, session_t * s)
while (s->bytes_to_send > 0)
{
- bytes_this_chunk = vec_len (test_data) < s->bytes_to_send
- ? vec_len (test_data) : s->bytes_to_send;
+
+ test_buf_offset = s->bytes_sent % vec_len (test_data);
+ bytes_this_chunk = vec_len (test_data) - test_buf_offset;
+
+ bytes_this_chunk = bytes_this_chunk < s->bytes_to_send
+ ? bytes_this_chunk : s->bytes_to_send;
rv = svm_fifo_enqueue_nowait (s->server_tx_fifo, 0 /*pid */ ,
bytes_this_chunk,
@@ -65,7 +69,7 @@ send_test_chunk (tclient_main_t * tm, session_t * s)
if (rv > 0)
{
s->bytes_to_send -= rv;
- test_buf_offset += rv;
+ s->bytes_sent += rv;
if (svm_fifo_set_event (s->server_tx_fifo))
{