未验证 提交 1abe8353 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1820 from Lawlieta/at

[net][at] Fix AT Socket select send data issue.
...@@ -200,7 +200,7 @@ static void at_do_event_changes(struct at_socket *sock, at_event_t event, rt_boo ...@@ -200,7 +200,7 @@ static void at_do_event_changes(struct at_socket *sock, at_event_t event, rt_boo
{ {
if (is_plus) if (is_plus)
{ {
sock->sendevent++; sock->sendevent = 1;
#ifdef SAL_USING_POSIX #ifdef SAL_USING_POSIX
rt_wqueue_wakeup(&sock->wait_head, (void*) POLLOUT); rt_wqueue_wakeup(&sock->wait_head, (void*) POLLOUT);
...@@ -209,7 +209,7 @@ static void at_do_event_changes(struct at_socket *sock, at_event_t event, rt_boo ...@@ -209,7 +209,7 @@ static void at_do_event_changes(struct at_socket *sock, at_event_t event, rt_boo
} }
else if (sock->sendevent) else if (sock->sendevent)
{ {
sock->sendevent --; sock->sendevent = 0;
} }
break; break;
} }
...@@ -252,6 +252,30 @@ static void at_do_event_changes(struct at_socket *sock, at_event_t event, rt_boo ...@@ -252,6 +252,30 @@ static void at_do_event_changes(struct at_socket *sock, at_event_t event, rt_boo
} }
} }
static void at_do_event_clean(struct at_socket *sock, at_event_t event)
{
switch (event)
{
case AT_EVENT_SEND:
{
sock->sendevent = 0;
break;
}
case AT_EVENT_RECV:
{
sock->rcvevent = 0;
break;
}
case AT_EVENT_ERROR:
{
sock->errevent = 0;
break;
}
default:
LOG_E("Not supported event (%d)", event);
}
}
static struct at_socket *alloc_socket(void) static struct at_socket *alloc_socket(void)
{ {
static rt_mutex_t at_slock = RT_NULL; static rt_mutex_t at_slock = RT_NULL;
...@@ -565,6 +589,8 @@ __exit: ...@@ -565,6 +589,8 @@ __exit:
at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE); at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE);
} }
at_do_event_changes(sock, AT_EVENT_SEND, RT_TRUE);
return result; return result;
} }
...@@ -688,6 +714,10 @@ __exit: ...@@ -688,6 +714,10 @@ __exit:
{ {
at_do_event_changes(sock, AT_EVENT_RECV, RT_TRUE); at_do_event_changes(sock, AT_EVENT_RECV, RT_TRUE);
} }
else
{
at_do_event_clean(sock, AT_EVENT_RECV);
}
} }
else else
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册