PERFORCE change 143792 for review

Rui Paulo rpaulo at FreeBSD.org
Thu Jun 19 23:02:35 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=143792

Change 143792 by rpaulo at rpaulo_epsilon on 2008/06/19 23:02:10

	Oops, add the CLOSING case.

Affected files ...

.. //depot/projects/soc2008/rpaulo-tcpad/handler.c#9 edit

Differences ...

==== //depot/projects/soc2008/rpaulo-tcpad/handler.c#9 (text+ko) ====

@@ -23,7 +23,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/soc2008/rpaulo-tcpad/handler.c#8 $
+ * $P4: //depot/projects/soc2008/rpaulo-tcpad/handler.c#9 $
  */
 
 #include <stdio.h>
@@ -146,7 +146,8 @@
 			cp->tcpstate = TCPS_CLOSE_WAIT;
 			rcp->tcpstate = TCPS_FIN_WAIT_2;
 		}
-		if (cp->tcpstate == TCPS_LAST_ACK) {
+		if (cp->tcpstate == TCPS_LAST_ACK ||
+		    cp->tcpstate == TCPS_CLOSING) {
 			cp->tcpstate = TCPS_TIME_WAIT;
 			printf("connection down\n");
 		}
@@ -166,6 +167,9 @@
 			cp->tcpstate = TCPS_TIME_WAIT;
 			rcp->tcpstate = TCPS_LAST_ACK;
 		}
+		if (cp->tcpstate == TCPS_FIN_WAIT_1) {
+			cp->tcpstate = TCPS_CLOSING;
+		}
 	} else if ((tcp->th_flags & TH_FLAGS) == (TH_RST|TH_ACK)) {
 		if (rcp && rcp->tcpstate == TCPS_SYN_SENT) {
 			DPRINTF("stopped tracking connection (rst) between"


More information about the p4-projects mailing list