fix socket nullptr bug
@@ -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;
