[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip TCP_HashTableElement.java, 1.2, 1.3 Tcp.java,
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-09-07 14:54:37
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9926/core/protocolsuite/tcp_ip Modified Files: TCP_HashTableElement.java Tcp.java Log Message: Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** Tcp.java 7 Sep 2006 14:08:54 -0000 1.71 --- Tcp.java 7 Sep 2006 14:54:34 -0000 1.72 *************** *** 142,145 **** --- 142,147 ---- private static final long TCP_CONNECT_TIME = 200; //msec time to resend all segments in SegmentsToresend queue when connecting + private static int timerid = 0; + /** * This method assigns the ParentStack *************** *** 168,174 **** public void TCPsetTimer(TCP_HashTableElement Elm, int inREP) { if(Elm.timer==null) { ! System.out.println("Sender timer init! Elm id = " + Elm.returnID()); Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_CONNECT_TIME,this, inREP),TCP_CONNECT_TIME,TCP_CONNECT_TIME); } else { System.out.println("Sender Timer REinit due to new packet arrival! Elm id = " + Elm.returnID()); --- 170,176 ---- public void TCPsetTimer(TCP_HashTableElement Elm, int inREP) { if(Elm.timer==null) { ! System.out.println("Sender timer init! Elm id = " + Elm.returnID() + " ID = " + timerid + " Elm connected to port:" + Elm.connectedtoPort); Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_CONNECT_TIME,this, inREP, timerid++),TCP_CONNECT_TIME,TCP_CONNECT_TIME); } else { System.out.println("Sender Timer REinit due to new packet arrival! Elm id = " + Elm.returnID()); *************** *** 176,181 **** Elm.timer=null; Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_SENDER_TIME,this, inREP), TCP_SENDER_TIME, TCP_SENDER_TIME); ! System.out.println(" Sender Timer REinit DONE!"); } --- 178,183 ---- Elm.timer=null; Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_SENDER_TIME,this, inREP, timerid++), TCP_SENDER_TIME, TCP_SENDER_TIME); ! System.out.println(" Sender Timer REinit DONE! ID = " + timerid + " Elm connected to port:" + Elm.connectedtoPort); } *************** *** 188,197 **** private long repTime; private Tcp TCPptr; ! public TCPTask(TCP_HashTableElement inElm, long time, Tcp inTCP, int inREP) { this.Elm=inElm; this.repTime=time; this.TCPptr=inTCP; this.numRepeat=inREP; } --- 190,201 ---- private long repTime; private Tcp TCPptr; + private int id; ! public TCPTask(TCP_HashTableElement inElm, long time, Tcp inTCP, int inREP, int id) { this.Elm=inElm; this.repTime=time; this.TCPptr=inTCP; this.numRepeat=inREP; + this.id = id; } *************** *** 204,208 **** public void run() { try{ ! // System.out.println("Timer start!"); if(!Elm.SegmentsToResend.isEmpty() && numRepeat>0) { // this.cancel(); --- 208,212 ---- public void run() { try{ ! System.out.println("Timer start! ID: " + id); if(!Elm.SegmentsToResend.isEmpty() && numRepeat>0) { // this.cancel(); *************** *** 245,256 **** Simulation.addLayerInfo(TCP_Info); Elm.addstats(TCPptr); ! ((Application)Elm.application).DisconnectEvent(); Elm.reset(); } else { //nothing to resend, but numRepeat>0 ! System.out.println("Timer cancel - part1! NumRepeat = " + numRepeat + " Elm id = " + Elm.returnID()); try{ numRepeat = 0; if(Elm.timer!=null){ ! Elm.timer.cancel(); this.cancel(); // ??? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< } --- 249,261 ---- Simulation.addLayerInfo(TCP_Info); Elm.addstats(TCPptr); ! if(Elm.application != null) ((Application)Elm.application).DisconnectEvent(); Elm.reset(); } else { //nothing to resend, but numRepeat>0 ! System.out.println("Timer cancel - part1! NumRepeat = " + numRepeat + " Elm id = " + Elm.returnID() + " Elm connected to port:" + Elm.connectedtoPort); try{ numRepeat = 0; + System.out.println(">>>>>>>>>>>>>>>>>>>> " + Elm.timer); if(Elm.timer!=null){ ! Elm.timer.cancel(); this.cancel(); // ??? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< } Index: TCP_HashTableElement.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/TCP_HashTableElement.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TCP_HashTableElement.java 7 Sep 2006 14:08:54 -0000 1.2 --- TCP_HashTableElement.java 7 Sep 2006 14:54:34 -0000 1.3 *************** *** 143,147 **** } System.out.println("Elm.reset: Timer cancel - part 2! Elm id = " + this.returnID()); ! this.timer = null; } --- 143,147 ---- } System.out.println("Elm.reset: Timer cancel - part 2! Elm id = " + this.returnID()); ! this.timer = null; } |