summaryrefslogtreecommitdiff
path: root/nuttx/net/accept.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-08 16:01:18 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-08 16:01:18 +0000
commit2239a0abb6976e310df0eb3307f089fdb23a3bbf (patch)
tree4de7080546c2d3472da727766e8d9d9a26db5f53 /nuttx/net/accept.c
parent4bbf891c9446414a9a1641a70bc90d294115bd6f (diff)
downloadnuttx-2239a0abb6976e310df0eb3307f089fdb23a3bbf.tar.gz
nuttx-2239a0abb6976e310df0eb3307f089fdb23a3bbf.tar.bz2
nuttx-2239a0abb6976e310df0eb3307f089fdb23a3bbf.zip
Eliminate most uIP globals
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@378 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/accept.c')
-rw-r--r--nuttx/net/accept.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/nuttx/net/accept.c b/nuttx/net/accept.c
index 66c05e989..34318190d 100644
--- a/nuttx/net/accept.c
+++ b/nuttx/net/accept.c
@@ -61,7 +61,6 @@ struct accept_s
#else
FAR const struct sockaddr_in *acpt_addr; /* Return connection adress */
#endif
- FAR struct uip_conn *acpt_listenconn; /* The listener connection */
FAR struct uip_conn *acpt_newconn; /* The accepted connection */
int acpt_result; /* The result of the wait */
};
@@ -80,11 +79,21 @@ struct accept_s
* Description:
* Receive interrupt level callbacks when connections occur
*
+ * Parameters:
+ * listener The conection stucture of the listener
+ * conn The connection stucture that was just accepted
+ *
+ * Returned Value:
+ * None
+ *
+ * Assumptions:
+ * Running at the interrupt level
+ *
****************************************************************************/
-static int accept_interrupt(void *private, struct uip_conn *conn)
+static int accept_interrupt(struct uip_conn *listener, struct uip_conn *conn)
{
- struct accept_s *pstate = (struct accept_s *)private;
+ struct accept_s *pstate = (struct accept_s *)listener->accept_private;
int ret = -EINVAL;
if (pstate)
{
@@ -92,16 +101,16 @@ static int accept_interrupt(void *private, struct uip_conn *conn)
#warning "need to return the address of the connection"
/* Save the connection structure */
-
- pstate->acpt_newconn = conn;
- pstate->acpt_result = OK;
+
+ pstate->acpt_newconn = conn;
+ pstate->acpt_result = OK;
sem_post(&pstate->acpt_sem);
-
+
/* Stop any further callbacks */
- pstate->acpt_listenconn->accept_private = NULL;
- pstate->acpt_listenconn->accept = NULL;
- ret = OK;
+ listener->accept_private = NULL;
+ listener->accept = NULL;
+ ret = OK;
}
return ret;
}
@@ -275,7 +284,6 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
save = irqsave();
state.acpt_addr = inaddr;
- state.acpt_listenconn = psock->s_conn;
state.acpt_newconn = NULL;
state.acpt_result = OK;