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

Function at_get_socket

components/net/at/at_socket/at_socket.c:64–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62static rt_slist_t _socket_list = RT_SLIST_OBJECT_INIT(_socket_list);
63
64struct at_socket *at_get_socket(int socket)
65{
66 rt_base_t level;
67 rt_slist_t *node = RT_NULL;
68 struct at_socket *at_sock = RT_NULL;
69
70 level = rt_hw_interrupt_disable();
71
72 rt_slist_for_each(node, &_socket_list)
73 {
74 at_sock = rt_slist_entry(node, struct at_socket, list);
75 if (at_sock && socket == at_sock->socket)
76 {
77 if (at_sock->magic == AT_SOCKET_MAGIC)
78 {
79 rt_hw_interrupt_enable(level);
80 return at_sock;
81 }
82 }
83 }
84
85 rt_hw_interrupt_enable(level);
86
87 return RT_NULL;
88}
89
90#ifdef AT_USING_SOCKET_SERVER
91struct at_socket *at_get_base_socket(int base_socket)

Callers 12

at_closesocketFunction · 0.85
at_shutdownFunction · 0.85
at_bindFunction · 0.85
at_connect_notice_cbFunction · 0.85
at_listenFunction · 0.85
at_connectFunction · 0.85
at_acceptFunction · 0.85
at_recvfromFunction · 0.85
at_sendtoFunction · 0.85
at_getsockoptFunction · 0.85
at_setsockoptFunction · 0.85
at_pollFunction · 0.85

Calls 2

rt_hw_interrupt_disableFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50

Tested by

no test coverage detected