From a2affa9a9c785386e618a9fed32fc6bf7892158b Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 8 Nov 2007 16:43:06 +0000 Subject: [PATCH] Fix handling of callback result git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@379 42af7a65-404d-4744-a932-0658087f49c3 --- configs/ntosd-dm320/netconfig | 8 ++++---- include/net/uip/uip.h | 5 ++++- net/uip/uip-tcpappsend.c | 4 ++++ net/uip/uip-tcpcallback.c | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/configs/ntosd-dm320/netconfig b/configs/ntosd-dm320/netconfig index e77eb15eda..f5e8e010e4 100644 --- a/configs/ntosd-dm320/netconfig +++ b/configs/ntosd-dm320/netconfig @@ -63,7 +63,7 @@ CONFIG_DRAM_SIZE=0x01000000 CONFIG_DRAM_START=0x01000000 CONFIG_DRAM_VSTART=0x00000000 CONFIG_DRAM_NUTTXENTRY=0x01008000 -CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_STACKDUMP=n # # DM320 specific device driver settings @@ -270,14 +270,14 @@ CONFIG_PREALLOC_TIMERS=8 CONFIG_NET=y CONFIG_NET_IPv6=n CONFIG_NSOCKET_DESCRIPTORS=8 -CONFIG_NET_MAX_CONNECTIONS=40 -CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_MAX_CONNECTIONS=8 +CONFIG_NET_MAX_LISTENPORTS=8 CONFIG_NET_SOCKOPTS=y CONFIG_NET_BUFFER_SIZE=420 CONFIG_NET_UDP=y CONFIG_NET_UDP_CHECKSUMS=y #CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_STATISTICS=y +CONFIG_NET_STATISTICS=n #CONFIG_NET_PINGADDRCONF=0 #CONFIG_NET_RECEIVE_WINDOW= #CONFIG_NET_ARPTAB_SIZE=8 diff --git a/include/net/uip/uip.h b/include/net/uip/uip.h index 155f0e6a77..e002777c35 100644 --- a/include/net/uip/uip.h +++ b/include/net/uip/uip.h @@ -185,7 +185,10 @@ struct uip_conn /* Higher level logic can retain application specific information * in the following: * - * data_event() is called on all events. + * data_event() is called on all events. May return one of the following: + * UIP_CLOSE - Gracefully close the current connection + * UIP_ABORT - Abort (reset) the current connection on an error that + * prevents UIP_CLOSE from working. * accept() is called when the TCP logic has created a connection * connection_event() is called on any of the subset of connection-related events */ diff --git a/net/uip/uip-tcpappsend.c b/net/uip/uip-tcpappsend.c index c0bbe8b48d..63bad3fbd7 100644 --- a/net/uip/uip-tcpappsend.c +++ b/net/uip/uip-tcpappsend.c @@ -98,6 +98,8 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn, uint8 resul { /* Handle the result based on the application response */ + vdbg("result: %02x\n", result); + if (result & UIP_ABORT) { dev->d_sndlen = 0; @@ -193,6 +195,8 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn, uint8 resul void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn, uint8 result) { + vdbg("result: %02x\n", result); + dev->d_appdata = dev->d_snddata; /* If the application has data to be sent, or if the incoming packet had diff --git a/net/uip/uip-tcpcallback.c b/net/uip/uip-tcpcallback.c index 4a314e9974..524b700847 100644 --- a/net/uip/uip-tcpcallback.c +++ b/net/uip/uip-tcpcallback.c @@ -75,7 +75,7 @@ uint8 uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, uint8 flags) { - uint8 ret = 0; + uint8 ret = flags & (UIP_ACKDATA|UIP_NEWDATA); vdbg("flags: %02x\n", flags); @@ -85,7 +85,7 @@ uint8 uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, uint8 fla { /* Perform the callback */ - ret = conn->data_event(dev, conn, flags); + ret |= conn->data_event(dev, conn, flags); } /* Check if there is a connection-related event and a connection