mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-18 18:43:31 +08:00
Merge pull request #2103 from thomasonegd/master
fix socket nullptr bug
This commit is contained in:
commit
9556288e54
@ -571,11 +571,17 @@ int at_connect(int socket, const struct sockaddr *name, socklen_t namelen)
|
||||
__exit:
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
if (sock != RT_NULL)
|
||||
{
|
||||
at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (sock)
|
||||
{
|
||||
at_do_event_changes(sock, AT_EVENT_SEND, RT_TRUE);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -699,6 +705,8 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f
|
||||
|
||||
__exit:
|
||||
|
||||
if (sock != RT_NULL)
|
||||
{
|
||||
if (recv_len > 0)
|
||||
{
|
||||
result = recv_len;
|
||||
@ -717,6 +725,7 @@ __exit:
|
||||
{
|
||||
at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -806,9 +815,12 @@ int at_sendto(int socket, const void *data, size_t size, int flags, const struct
|
||||
__exit:
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
if (sock != RT_NULL)
|
||||
{
|
||||
at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user