diff --git a/aeron-driver/src/main/c/uri/aeron_driver_uri.c b/aeron-driver/src/main/c/uri/aeron_driver_uri.c index 10110c78a3..7dbd338606 100644 --- a/aeron-driver/src/main/c/uri/aeron_driver_uri.c +++ b/aeron-driver/src/main/c/uri/aeron_driver_uri.c @@ -125,7 +125,7 @@ int aeron_uri_get_publication_window_length_param(aeron_uri_params_t *uri_params { AERON_SET_ERR( EINVAL, - "%s=" PRIu64 " cannot be less than the %s=" PRIu64, + "%s=%" PRIu64 " cannot be less than the %s=%" PRIu64, AERON_URI_PUBLICATION_WINDOW_KEY, value, AERON_URI_MTU_LENGTH_KEY, @@ -137,7 +137,7 @@ int aeron_uri_get_publication_window_length_param(aeron_uri_params_t *uri_params { AERON_SET_ERR( EINVAL, - "%s=" PRIu64 " must not exceed half the %s=" PRIu64, + "%s=%" PRIu64 " must not exceed half the %s=%" PRIu64, AERON_URI_PUBLICATION_WINDOW_KEY, value, AERON_URI_TERM_LENGTH_KEY, diff --git a/aeron-driver/src/test/c/aeron_driver_uri_test.cpp b/aeron-driver/src/test/c/aeron_driver_uri_test.cpp index dfb366700a..bab910e66a 100644 --- a/aeron-driver/src/test/c/aeron_driver_uri_test.cpp +++ b/aeron-driver/src/test/c/aeron_driver_uri_test.cpp @@ -383,6 +383,24 @@ TEST_F(DriverUriTest, shouldFailWithInvalidMaxRetransmits) EXPECT_THAT(std::string(aeron_errmsg()), ::testing::HasSubstr("could not parse max-resend")); } +TEST_F(DriverUriTest, shouldFailWithPublicationWindowLessThanMtu) +{ + aeron_driver_uri_publication_params_t params; + + EXPECT_EQ(AERON_URI_PARSE("aeron:udp?endpoint=224.10.9.8|pub-wnd=2048|mtu=4096", &m_uri), 0); + EXPECT_EQ(aeron_diver_uri_publication_params(&m_uri, ¶ms, &m_conductor, false), -1); + EXPECT_THAT(std::string(aeron_errmsg()), ::testing::HasSubstr("pub-wnd=2048 cannot be less than the mtu=4096")); +} + +TEST_F(DriverUriTest, shouldFailWithPublicationWindowMoreThanHalfTermLength) +{ + aeron_driver_uri_publication_params_t params; + + EXPECT_EQ(AERON_URI_PARSE("aeron:udp?endpoint=224.10.9.8|pub-wnd=262144|term-length=65536", &m_uri), 0); + EXPECT_EQ(aeron_diver_uri_publication_params(&m_uri, ¶ms, &m_conductor, false), -1); + EXPECT_THAT(std::string(aeron_errmsg()), ::testing::HasSubstr("pub-wnd=262144 must not exceed half the term-length=65536")); +} + class UriResolverTest : public testing::Test { public: