[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip Tcp.java, 1.62, 1.63
Status: Beta
Brought to you by:
darkkey
From: gift <gi...@us...> - 2006-09-03 13:05:34
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2539/core/protocolsuite/tcp_ip Modified Files: Tcp.java Log Message: VVVVV Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Tcp.java 3 Sep 2006 12:31:48 -0000 1.62 --- Tcp.java 3 Sep 2006 13:05:31 -0000 1.63 *************** *** 1135,1139 **** listener = (Application)Elm.application; ! //AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs --- 1135,1139 ---- listener = (Application)Elm.application; ! AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs *************** *** 1228,1232 **** listener = (Application)Elm.application; ! //AddOutputBuffer(Elm, inPacket); try{ --- 1228,1232 ---- listener = (Application)Elm.application; ! AddOutputBuffer(Elm, inPacket); try{ *************** *** 1349,1353 **** listener = (Application)Elm.application; //Elm.isFIN_sent=true; - will be set in "sendTCPSegment" ! //AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs System.out.println(mParentStack.getHostName() + ":" + "FIN-packet FIN not sent, BEFORE: I=" + inPacket.get_sequence_number()); --- 1349,1353 ---- listener = (Application)Elm.application; //Elm.isFIN_sent=true; - will be set in "sendTCPSegment" ! AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs System.out.println(mParentStack.getHostName() + ":" + "FIN-packet FIN not sent, BEFORE: I=" + inPacket.get_sequence_number()); *************** *** 1379,1383 **** Elm.isFIN_confirmed=true; ! //AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs // Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); --- 1379,1383 ---- Elm.isFIN_confirmed=true; ! AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs // Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); *************** *** 1465,1468 **** --- 1465,1469 ---- s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed!"; Elm.ApplicationStatus=2; + //Elm.last_passed=chk-1; } *************** *** 1501,1512 **** if (Elm.ApplicationStatus!=2) { ! s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed!"; Elm.ApplicationStatus=2; ! } else s = "TCP packet with data received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Passing data to application program. (received SEQ = " + inPacket.get_sequence_number() + " sent ACK = " + ack_num + ")."; ! ! if (!(mParentStack.sendTCPSegment(listener,msg,flags,ack_num))) { ! Elm.SentACKs.remove(inPacket.get_sequence_number()); ! } ! //Create Layer info LayerInfo TCP_Info = new LayerInfo(getClass().getName()); --- 1502,1510 ---- if (Elm.ApplicationStatus!=2) { ! s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed! Data will be passed to the application!"; Elm.ApplicationStatus=2; ! Elm.last_passed=chk-1; ! } else s = "TCP packet with data received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Passing data to application program. (received SEQ = " + inPacket.get_sequence_number() + " sent ACK = " + ack_num + ")."; ! //Create Layer info LayerInfo TCP_Info = new LayerInfo(getClass().getName()); *************** *** 1522,1525 **** --- 1520,1527 ---- Simulation.addLayerInfo(TCP_Info); + if (!(mParentStack.sendTCPSegment(listener,msg,flags,ack_num))) { + Elm.SentACKs.remove(inPacket.get_sequence_number()); + } + // if (Elm.received_segments>2) // listener.RecvData(inPacket.getTCP_message()); *************** *** 1815,1819 **** Elm.last_passed=kkey; TCP_packet Packet=(TCP_packet) Elm.OutputBuffer.remove(kkey); ! kkey++; if((!Packet.get_ACK_flag()) && (!Packet.get_SYN_flag())) //if(!Packet.get_ACK_flag()) --- 1817,1822 ---- Elm.last_passed=kkey; TCP_packet Packet=(TCP_packet) Elm.OutputBuffer.remove(kkey); ! kkey++; ! if((!Packet.get_ACK_flag()) && (!Packet.get_SYN_flag())) //if(!Packet.get_ACK_flag()) |