summaryrefslogtreecommitdiff
path: root/nuttx/net/uip/uip-tcpcallback.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-27 19:19:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-27 19:19:30 +0000
commit2a9b51de584c89c6a2dcb85cafb74424a47545cd (patch)
tree414e720883d4373d9a95fda398bdd4f799cc79b4 /nuttx/net/uip/uip-tcpcallback.c
parent20c3067ff452e4e4604e11ec37479c50a4444de8 (diff)
downloadpx4-nuttx-2a9b51de584c89c6a2dcb85cafb74424a47545cd.tar.gz
px4-nuttx-2a9b51de584c89c6a2dcb85cafb74424a47545cd.tar.bz2
px4-nuttx-2a9b51de584c89c6a2dcb85cafb74424a47545cd.zip
Fixed missing logic in readahead buffer logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@409 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip/uip-tcpcallback.c')
-rw-r--r--nuttx/net/uip/uip-tcpcallback.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/nuttx/net/uip/uip-tcpcallback.c b/nuttx/net/uip/uip-tcpcallback.c
index 845c49a81..d96e97981 100644
--- a/nuttx/net/uip/uip-tcpcallback.c
+++ b/nuttx/net/uip/uip-tcpcallback.c
@@ -84,7 +84,7 @@ uip_dataevent(struct uip_driver_s *dev, struct uip_conn *conn, uint8 flags)
* can have zero-length with UIP_NEWDATA set just to cause an ACK).
*/
- if (uip_newdata_event(flags) && dev->d_len > 0)
+ if ((flags & UIP_NEWDATA) != 0 && dev->d_len > 0)
{
#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0
/* Allocate a read-ahead buffer to hold the newly received data */
@@ -174,7 +174,7 @@ uint8 uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, uint8 fla
if (conn->data_event)
{
/* Perform the callback. Callback function normally returns the input flags,
- * however, the implemenation may set one of the following:
+ * however, the implementation may set one of the following:
*
* UIP_CLOSE - Gracefully close the current connection
* UIP_ABORT - Abort (reset) the current connection on an error that
@@ -188,12 +188,17 @@ uint8 uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, uint8 fla
ret = conn->data_event(dev, conn, flags);
}
- else
+
+ /* If there is no data callback -OR- if the data callback does not handle the
+ * newdata event, then there is no handler in place to handle new incoming data.
+ */
+
+ if (!conn->data_event || (conn->data_flags & UIP_NEWDATA) == 0)
{
- /* There is no handler to receive new data in place */
+ /* In either case, we will take a default newdata action */
nvdbg("No listener on connection\n");
- ret = uip_dataevent(dev, conn, flags);
+ ret = uip_dataevent(dev, conn, ret);
}
/* Check if there is a connection-related event and a connection