Skip to content

Allow NSAPI_ERROR_UNSUPPORTED from Socket::setsockopt() #9415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion TESTS/netsocket/tcp/tcpsocket_setsockopt_keepalive_valid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ void TCPSOCKET_SETSOCKOPT_KEEPALIVE_VALID()
TCPSocket sock;
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(get_interface()));
int32_t seconds = 7200;
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.setsockopt(NSAPI_SOCKET, NSAPI_KEEPALIVE, &seconds, sizeof(int)));

int ret = sock.setsockopt(NSAPI_SOCKET, NSAPI_KEEPALIVE, &seconds, sizeof(int));

if (ret == NSAPI_ERROR_UNSUPPORTED) {
TEST_IGNORE_MESSAGE("NSAPI_KEEPALIVE option not supported");
sock.close();
return;
}

TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, ret);
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.connect(MBED_CONF_APP_ECHO_SERVER_ADDR, 9));
// LWIP stack does not support getsockopt so the part below is commented out
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the getsockopt test part can be implemented in the same way ?
(instead of commenting lines...)

// int32_t optval;
Expand Down