13627105546 opened a new pull request, #17877:
URL: https://github.com/apache/nuttx/pull/17877

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   This PR addresses an issue where `usrsock` repeatedly sets `POLLIN` events 
when the network interface is down and a client attempts to connect, leading to 
an infinite loop or abnormal `EPIPE` setting.
   
   The changes involve:
   1.  Clearing the `USRSOCK_EVENT_RECVFROM_AVAIL` flag when a remote 
connection is closed during `accept`.
   2.  Checking the `USRSOCK_EVENT_RECVFROM_AVAIL` flag before setting `POLLIN` 
in both `poll_event` and `usrsock_pollsetup`.
   
   By ensuring `POLLIN` is only set when data is actually available (indicated 
by the flag), we prevent the repetitive `POLLIN` triggering that causes the 
`EPIPE` loop.
   
   ## Impact
   
   *   **Impact on user**: Fixes a potential system hang or high CPU usage loop 
in `usrsock` when handling connection attempts on a down interface.
   *   **Backward compatibility**: Yes.
   *   **New feature**: No, bug fix.
   
   ## Testing
   
   *   **Verification**:
       *   Verified that `POLLIN` is no longer repeatedly set when the remote 
closes the connection during an accept sequence on a down interface.
       *   Passed `tools/checkpatch.sh`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to