diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-23 13:31:28 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-11-23 13:31:28 +0000 |
commit | 403a4936c8fc3756003a28328c18c770bc914b6d (patch) | |
tree | 1f09ba2f05bd7c92efe529d4f4bc0a065b4b3298 /nuttx/net/sendto.c | |
parent | 797f58d1f0e2265f7c3c054eb1b8f7bfe4fcecfc (diff) | |
download | px4-nuttx-403a4936c8fc3756003a28328c18c770bc914b6d.tar.gz px4-nuttx-403a4936c8fc3756003a28328c18c770bc914b6d.tar.bz2 px4-nuttx-403a4936c8fc3756003a28328c18c770bc914b6d.zip |
Debug UDP send logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@401 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/sendto.c')
-rw-r--r-- | nuttx/net/sendto.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/nuttx/net/sendto.c b/nuttx/net/sendto.c index e6f267a69..ba9bac0af 100644 --- a/nuttx/net/sendto.c +++ b/nuttx/net/sendto.c @@ -95,18 +95,19 @@ void sendto_interrupt(struct uip_driver_s *dev, struct uip_udp_conn *conn, uint8 struct sendto_s *pstate = (struct sendto_s *)conn->private; if (pstate) { - /* Check if the connectin was rejected */ + /* Check if the connection was rejected */ if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) { + /* Yes.. then terminate with an error */ + pstate->st_sndlen = -ENOTCONN; } else { - /* Copy the user data into d_appdata and send it */ + /* No.. Copy the user data into d_snddata and send it */ - memcpy(dev->d_appdata, pstate->st_buffer, pstate->st_buflen); - uip_send(dev, dev->d_appdata, pstate->st_buflen); + uip_send(dev, pstate->st_buffer, pstate->st_buflen); pstate->st_sndlen = pstate->st_buflen; } @@ -264,7 +265,7 @@ ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, * are ready. */ - save = irqsave(); + save = irqsave(); memset(&state, 0, sizeof(struct sendto_s)); sem_init(&state.st_sem, 0, 0); state.st_buflen = len; @@ -282,7 +283,7 @@ ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, /* Set up the callback in the connection */ - udp_conn = (struct uip_udp_conn *)psock->s_conn; + udp_conn = (struct uip_udp_conn *)psock->s_conn; udp_conn->private = (void*)&state; udp_conn->event = sendto_interrupt; @@ -290,7 +291,7 @@ ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, uip_udpenable(psock->s_conn); - /* Notify the device driver of the availaibilty of TX data */ + /* Notify the device driver of the availabilty of TX data */ netdev_txnotify(&udp_conn->ripaddr); |