aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-11 17:51:41 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-11 17:51:41 -0700
commitee4572147ade37bf07f8ef2f3049e8c81df312b7 (patch)
tree8a50a209aed7048671c567cae2780c779d95770d /tests
parent2a11fd60767335660dc506237a9302dcbc5da91e (diff)
downloadnng-ee4572147ade37bf07f8ef2f3049e8c81df312b7.tar.gz
nng-ee4572147ade37bf07f8ef2f3049e8c81df312b7.tar.bz2
nng-ee4572147ade37bf07f8ef2f3049e8c81df312b7.zip
Fix leaks found in pairv1 test suite.
Diffstat (limited to 'tests')
-rw-r--r--tests/pair1.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/pair1.c b/tests/pair1.c
index b9ef9f03..da5eaa24 100644
--- a/tests/pair1.c
+++ b/tests/pair1.c
@@ -34,6 +34,7 @@ TestMain("PAIRv1 protocol", {
nng_close(s1);
nng_close(c1);
nng_close(c2);
+ nng_usleep(10000);
nni_fini();
});
@@ -119,7 +120,7 @@ TestMain("PAIRv1 protocol", {
So(nng_setopt(s1, NNG_OPT_RCVBUF, &r, sizeof(r)) == 0);
So(nng_setopt(s1, NNG_OPT_SNDBUF, &r, sizeof(r)) == 0);
So(nng_setopt(c1, NNG_OPT_RCVBUF, &r, sizeof(r)) == 0);
- tmo = 10000;
+ tmo = 100000;
So(nng_setopt(
s1, NNG_OPT_SNDTIMEO, &tmo, sizeof(tmo)) == 0);
@@ -129,6 +130,7 @@ TestMain("PAIRv1 protocol", {
for (i = 0, rv = 0; i < 10; i++) {
So(nng_msg_alloc(&msg, 0) == 0);
if ((rv = nng_sendmsg(s1, msg, 0)) != 0) {
+ nni_msg_free(msg);
break;
}
}
@@ -146,7 +148,7 @@ TestMain("PAIRv1 protocol", {
So(nng_setopt(s1, NNG_OPT_SNDBUF, &r, sizeof(r)) == 0);
So(nng_setopt(c1, NNG_OPT_RCVBUF, &r, sizeof(r)) == 0);
- tmo = 10000;
+ tmo = 30000;
So(nng_setopt(
s1, NNG_OPT_SNDTIMEO, &tmo, sizeof(tmo)) == 0);
@@ -232,6 +234,7 @@ TestMain("PAIRv1 protocol", {
So(nng_recvmsg(s1, &msg, 0) == 0);
So(nng_msg_trim_u32(msg, &v) == 0);
So(v == 0xFEEDFACE);
+ nng_msg_free(msg);
});
Convey("Reserved bits in raw header", {
@@ -254,6 +257,7 @@ TestMain("PAIRv1 protocol", {
So(nng_recvmsg(s1, &msg, 0) == 0);
So(nng_msg_trim_u32(msg, &v) == 0);
So(v == 0xFEEDFACE);
+ nng_msg_free(msg);
});
});
@@ -288,7 +292,9 @@ TestMain("PAIRv1 protocol", {
So(nng_msg_header_trim_u32(msg, &v) ==
0);
So(v == 4);
+ nng_msg_free(msg);
});
+
Convey("Large TTL passes", {
ttl = 0xff;
So(nng_setopt(s1, NNG_OPT_MAXTTL, &ttl,
@@ -304,7 +310,9 @@ TestMain("PAIRv1 protocol", {
So(nng_msg_header_trim_u32(msg, &v) ==
0);
So(v == 0xff);
+ nng_msg_free(msg);
});
+
Convey("Max TTL fails", {
ttl = 0xff;
So(nng_setopt(s1, NNG_OPT_MAXTTL, &ttl,