MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / TC_sal_socket_close

Function TC_sal_socket_close

components/net/utest/tc_sal_socket.c:922–946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

920}
921
922static void TC_sal_socket_close(void)
923{
924 int sock = -1;
925
926 LOG_I("Starting TC_sal_socket_close tests...");
927
928 /* Test close valid socket */
929 LOG_I("Testing close valid socket...");
930 sock = create_test_socket(AF_INET, SOCK_STREAM, 0);
931 LOG_I("Closing socket %d...", sock);
932 uassert_int_equal(sal_closesocket(sock), 0);
933 sock = -1;
934
935 /* Test close invalid socket */
936 LOG_I("Testing close invalid socket...");
937 uassert_int_equal(sal_closesocket(-1), -1);
938
939 /* Test double close */
940 LOG_I("Testing double close...");
941 sock = create_test_socket(AF_INET, SOCK_STREAM, 0);
942 sal_closesocket(sock);
943 LOG_I("Double closing socket %d (should be safe)", sock);
944
945 LOG_I("TC_sal_socket_close tests completed");
946}
947
948static void TC_sal_socket_getpeername_getsockname(void)
949{

Callers

nothing calls this directly

Calls 2

create_test_socketFunction · 0.85
sal_closesocketFunction · 0.85

Tested by

no test coverage detected