From 38c005e7c07b5ccaab3345dc8c66cbc27b95692a Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 20 Jan 2020 23:31:55 -0800 Subject: fixes #1169 survey and xsurvey could use message cloning fixes #1160 Consider limiting maximum hop count to 15 fixes #1098 Maximum maxTTL should be compile time defined This doesn't expose the max-MaxTTL in the CMakeList.txt -- there is really no reason anyone should be changing it. This does not yet inline the message header into the nni_msg_t, but it is my intention to do so soon, and eliminate most of the conditional cases for failure on inserting into the header. --- src/protocol/pair1/pair1_test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/protocol/pair1/pair1_test.c') diff --git a/src/protocol/pair1/pair1_test.c b/src/protocol/pair1/pair1_test.c index 08f808a5..7011606a 100644 --- a/src/protocol/pair1/pair1_test.c +++ b/src/protocol/pair1/pair1_test.c @@ -575,22 +575,22 @@ test_ttl(void) nng_msg_free(msg); // Large TTL passes - TEST_CHECK(nng_setopt_int(s1, NNG_OPT_MAXTTL, 0xff) == 0); + TEST_CHECK(nng_setopt_int(s1, NNG_OPT_MAXTTL, 15) == 0); TEST_CHECK(nng_msg_alloc(&msg, 0) == 0); TEST_CHECK(nng_msg_append_u32(msg, 1234) == 0); - TEST_CHECK(nng_msg_header_append_u32(msg, 0xfe) == 0); + TEST_CHECK(nng_msg_header_append_u32(msg, 14) == 0); TEST_CHECK(nng_sendmsg(c1, msg, 0) == 0); TEST_CHECK(nng_recvmsg(s1, &msg, 0) == 0); TEST_CHECK(nng_msg_trim_u32(msg, &val) == 0); TEST_CHECK(val == 1234); TEST_CHECK(nng_msg_header_trim_u32(msg, &val) == 0); - TEST_CHECK(val == 0xff); + TEST_CHECK(val == 15); nng_msg_free(msg); // Max TTL fails - TEST_CHECK(nng_setopt_int(s1, NNG_OPT_MAXTTL, 0xff) == 0); + TEST_CHECK(nng_setopt_int(s1, NNG_OPT_MAXTTL, 15) == 0); TEST_CHECK(nng_msg_alloc(&msg, 0) == 0); - TEST_CHECK(nng_msg_header_append_u32(msg, 0xff) == 0); + TEST_CHECK(nng_msg_header_append_u32(msg, 15) == 0); TEST_CHECK(nng_sendmsg(c1, msg, 0) == 0); TEST_CHECK(nng_recvmsg(s1, &msg, 0) == NNG_ETIMEDOUT); -- cgit v1.2.3-70-g09d2