未验证 提交 9556288e 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #2103 from thomasonegd/master

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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册