diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-09-10 22:55:52 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-09-10 22:55:52 +0000 |
commit | ded24f77f6c906ded017b80ccf95755e454af674 (patch) | |
tree | 0a8b023170b5ffa3a038685c7432abd8041036d1 /nuttx/net/uip | |
parent | be7679e03da5bfac034c384fdd62b70afef88326 (diff) | |
download | px4-nuttx-ded24f77f6c906ded017b80ccf95755e454af674.tar.gz px4-nuttx-ded24f77f6c906ded017b80ccf95755e454af674.tar.bz2 px4-nuttx-ded24f77f6c906ded017b80ccf95755e454af674.zip |
Fix race condition bug in poll() for backlogged connections
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2032 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip')
-rw-r--r-- | nuttx/net/uip/uip_tcpbacklog.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nuttx/net/uip/uip_tcpbacklog.c b/nuttx/net/uip/uip_tcpbacklog.c index 8e6d1fb90..d97acde9c 100644 --- a/nuttx/net/uip/uip_tcpbacklog.c +++ b/nuttx/net/uip/uip_tcpbacklog.c @@ -265,6 +265,25 @@ int uip_backlogadd(FAR struct uip_conn *conn, FAR struct uip_conn *blconn) * Function: uip_backlogremove * * Description: + * Called from poll(). Before waiting for a new connection, poll will + * call this API to see if there are pending connections in the backlog. + * + * Assumptions: + * Called from normal user code, but with interrupts disabled, + * + ****************************************************************************/ + +#ifndef CONFIG_DISABLE_POLL +boolean uip_backlogavailable(FAR struct uip_conn *conn) +{ + return (conn && conn->backlog && !sq_empty(&conn->backlog->bl_pending)); +} +#endif + +/**************************************************************************** + * Function: uip_backlogremove + * + * Description: * Called from accept(). Before waiting for a new connection, accept will * call this API to see if there are pending connections in the backlog. * |