usrsock: update state to connected when recv sento ready under connecting

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2022-10-12 18:11:18 +08:00 committed by Masayuki Ishikawa
parent 28180b49d1
commit be06d00f85
2 changed files with 16 additions and 2 deletions

View File

@ -262,6 +262,12 @@ static ssize_t usrsock_handle_response(FAR struct usrsock_conn_s *conn,
*/ */
conn->resp.inprogress = true; conn->resp.inprogress = true;
/* This branch indicates successful processing and waiting
* for USRSOCK_EVENT_CONNECT_READY event.
*/
conn->resp.result = 0;
} }
else else
{ {
@ -313,6 +319,13 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn,
*/ */
conn->resp.inprogress = true; conn->resp.inprogress = true;
/* This branch indicates successful processing and waiting
* for USRSOCK_EVENT_CONNECT_READY event.
*/
conn->resp.result = 0;
return sizeof(*datahdr); return sizeof(*datahdr);
} }

View File

@ -67,9 +67,10 @@ int usrsock_event(FAR struct usrsock_conn_s *conn)
/* Generic state updates. */ /* Generic state updates. */
if (events & USRSOCK_EVENT_REQ_COMPLETE) if (conn->state == USRSOCK_CONN_STATE_CONNECTING)
{ {
if (conn->state == USRSOCK_CONN_STATE_CONNECTING) if ((events & USRSOCK_EVENT_REQ_COMPLETE) ||
(events & USRSOCK_EVENT_SENDTO_READY))
{ {
conn->state = USRSOCK_CONN_STATE_READY; conn->state = USRSOCK_CONN_STATE_READY;
events |= USRSOCK_EVENT_CONNECT_READY; events |= USRSOCK_EVENT_CONNECT_READY;