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 <liangchaozhong@xiaomi.com>
This commit is contained in:
parent
be06d00f85
commit
c75253623d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user