summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton <anton@picapica>2017-09-04 22:31:11 +0400
committerAnton <anton@picapica>2017-09-04 22:31:11 +0400
commit1ec1d72b5dc98b93c86b4a09950a3e975efe8487 (patch)
tree7c56457a81877ebb4d2ed62f8f3e62a369c452ee
parentc0713b9a9ffca4516b44127cc335332a9405eb27 (diff)
downloadpica-pica-1ec1d72b5dc98b93c86b4a09950a3e975efe8487.tar.gz
pica-pica-1ec1d72b5dc98b93c86b4a09950a3e975efe8487.zip
test_client: wait for reply before sending next message in random message mode
-rw-r--r--tests/test_client.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test_client.c b/tests/test_client.c
index 691dd6d..d78441e 100644
--- a/tests/test_client.c
+++ b/tests/test_client.c
@@ -24,6 +24,7 @@ int c2c_in_progress = 0;
int echo_mode = 0;
int random_message_mode = 0;
int delivery_acks_count = 0;
+int rmm_wait_for_reply = 0;
unsigned char buf[64 * 1024];
@@ -55,9 +56,10 @@ void newmsg_cb(const unsigned char *peer_id, const char* msgbuf, unsigned int nb
if (memcmp(msgbuf, buf, nb) != 0)
{
printf("sent and returned messages are not equal!\n");
- return 1;
+ exit(1);
}
+ rmm_wait_for_reply = 0;
}
memcpy(buf, msgbuf, nb);
@@ -374,7 +376,7 @@ cert_filename should point to file that contains client certificate, private key
}
- if (random_message_mode && connected_to_node == 1 && c2c_active == 1)
+ if (random_message_mode && connected_to_node == 1 && c2c_active == 1 && rmm_wait_for_reply == 0)
{
static int test_stage = 0;
@@ -384,6 +386,7 @@ cert_filename should point to file that contains client certificate, private key
case 0:
ret = PICA_send_msg(chn, NULL, 0);
test_stage++;
+ rmm_wait_for_reply = 1;
break;
//send max length message
@@ -391,6 +394,7 @@ cert_filename should point to file that contains client certificate, private key
memset(buf, 'X', PICA_PROTO_C2CMSG_MAXDATASIZE);
ret = PICA_send_msg(chn, buf, PICA_PROTO_C2CMSG_MAXDATASIZE);
test_stage++;
+ rmm_wait_for_reply = 1;
break;
//send random length message
@@ -402,6 +406,7 @@ cert_filename should point to file that contains client certificate, private key
memset(buf, 'x', ret);
ret = PICA_send_msg(chn, buf, ret);
test_stage++;
+ rmm_wait_for_reply = 1;
break;
default: