This is an automated email from the ASF dual-hosted git repository. masayuki pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit c75253623d60fb034670e0921642caa1b339db9e Author: liangchaozhong <liangchaozh...@xiaomi.com> AuthorDate: Fri Sep 16 18:43:34 2022 +0800 usrsock:fix blocking socket connect operation hang issue Issue description: usrsock will wait for state.recvsem forever because no event triggers state.recvsem post operation when connect operation in server side is non-blocking. Solution: trigger state.recvsem post operation after receive USRSOCK_EVENT_SENDTO_READY. Signed-off-by: liangchaozhong <liangchaozh...@xiaomi.com> --- net/usrsock/usrsock_connect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/usrsock/usrsock_connect.c b/net/usrsock/usrsock_connect.c index 6e40fc0eb1..7793f6847a 100644 --- a/net/usrsock/usrsock_connect.c +++ b/net/usrsock/usrsock_connect.c @@ -65,7 +65,7 @@ static uint16_t connect_event(FAR struct net_driver_s *dev, nxsem_post(&pstate->recvsem); } - else if (flags & USRSOCK_EVENT_REQ_COMPLETE) + else { ninfo("request completed.\n"); @@ -199,7 +199,8 @@ int usrsock_connect(FAR struct socket *psock, ret = usrsock_setup_request_callback(conn, &state, connect_event, USRSOCK_EVENT_ABORT | - USRSOCK_EVENT_REQ_COMPLETE); + USRSOCK_EVENT_REQ_COMPLETE | + USRSOCK_EVENT_SENDTO_READY); if (ret < 0) { nwarn("usrsock_setup_request_callback failed: %d\n", ret);