diff --git a/net/usrsock/usrsock_devif.c b/net/usrsock/usrsock_devif.c index 78f1579850..c71eb6a76b 100644 --- a/net/usrsock/usrsock_devif.c +++ b/net/usrsock/usrsock_devif.c @@ -262,6 +262,12 @@ static ssize_t usrsock_handle_response(FAR struct usrsock_conn_s *conn, */ conn->resp.inprogress = true; + + /* This branch indicates successful processing and waiting + * for USRSOCK_EVENT_CONNECT_READY event. + */ + + conn->resp.result = 0; } else { @@ -313,6 +319,13 @@ usrsock_handle_datareq_response(FAR struct usrsock_conn_s *conn, */ conn->resp.inprogress = true; + + /* This branch indicates successful processing and waiting + * for USRSOCK_EVENT_CONNECT_READY event. + */ + + conn->resp.result = 0; + return sizeof(*datahdr); } diff --git a/net/usrsock/usrsock_event.c b/net/usrsock/usrsock_event.c index ef6c30534f..f365e16f45 100644 --- a/net/usrsock/usrsock_event.c +++ b/net/usrsock/usrsock_event.c @@ -67,9 +67,10 @@ int usrsock_event(FAR struct usrsock_conn_s *conn) /* 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; events |= USRSOCK_EVENT_CONNECT_READY;