Skip to content

Commit 7b29593

Browse files
authored
Merge pull request #9415 from SeppoTakalo/ONME-4140
Allow NSAPI_ERROR_UNSUPPORTED from Socket::setsockopt()
2 parents 4019efb + 26dcd0d commit 7b29593

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

TESTS/netsocket/tcp/tcpsocket_setsockopt_keepalive_valid.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,16 @@ void TCPSOCKET_SETSOCKOPT_KEEPALIVE_VALID()
2929
TCPSocket sock;
3030
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance()));
3131
int32_t seconds = 7200;
32-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.setsockopt(NSAPI_SOCKET, NSAPI_KEEPALIVE, &seconds, sizeof(int)));
32+
33+
int ret = sock.setsockopt(NSAPI_SOCKET, NSAPI_KEEPALIVE, &seconds, sizeof(int));
34+
35+
if (ret == NSAPI_ERROR_UNSUPPORTED) {
36+
TEST_IGNORE_MESSAGE("NSAPI_KEEPALIVE option not supported");
37+
sock.close();
38+
return;
39+
}
40+
41+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, ret);
3342
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.connect(MBED_CONF_APP_ECHO_SERVER_ADDR, 9));
3443
// LWIP stack does not support getsockopt so the part below is commented out
3544
// int32_t optval;

0 commit comments

Comments
 (0)