[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip Udp.java,1.12,1.13
Status: Beta
Brought to you by:
darkkey
From: gift <gi...@us...> - 2005-11-20 14:07:26
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2019/core/protocolsuite/tcp_ip Modified Files: Udp.java Log Message: bad style removed.... maybe bad, maybe not Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Udp.java 20 Nov 2005 13:51:31 -0000 1.12 --- Udp.java 20 Nov 2005 14:07:13 -0000 1.13 *************** *** 446,457 **** public void ClosePort(Object application) throws TransportLayerException //changes port status from 1 (listen) to 0 (free) { ! UDP_HashTableElement oldElm=null; Integer PortToClose=getApplicationLocalPortNumber(application); ! oldElm=(UDP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (oldElm.PortStatus==1) { ! UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=0; Elm.application=null; --- 446,457 ---- public void ClosePort(Object application) throws TransportLayerException //changes port status from 1 (listen) to 0 (free) { ! UDP_HashTableElement Elm=null; Integer PortToClose=getApplicationLocalPortNumber(application); ! Elm=(UDP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (Elm.PortStatus==1) { ! //UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=0; Elm.application=null; *************** *** 459,464 **** Elm.connectedtoPort=0; ! PortTable.remove(PortToClose); //delete old element ! PortTable.put(PortToClose,Elm); //hash table update } else throw new TransportLayerException("UDP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); } --- 459,464 ---- Elm.connectedtoPort=0; ! //PortTable.remove(PortToClose); //delete old element ! //PortTable.put(PortToClose,Elm); //hash table update } else throw new TransportLayerException("UDP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); } *************** *** 475,486 **** public void FreePort(Object application) throws TransportLayerException //changes port status from 3 (listen) to 0 (free) { ! UDP_HashTableElement oldElm=null; Integer PortToFree=getApplicationLocalPortNumber(application); ! oldElm=(UDP_HashTableElement) PortTable.get((Integer)PortToFree); ! if (oldElm.PortStatus==2) { ! UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=0; Elm.application=null; --- 475,486 ---- public void FreePort(Object application) throws TransportLayerException //changes port status from 3 (listen) to 0 (free) { ! UDP_HashTableElement Elm=null; Integer PortToFree=getApplicationLocalPortNumber(application); ! Elm=(UDP_HashTableElement) PortTable.get((Integer)PortToFree); ! if (Elm.PortStatus==2) { ! //UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=0; Elm.application=null; *************** *** 488,493 **** Elm.connectedtoPort=0; ! PortTable.remove(PortToFree); //delete old element ! PortTable.put(PortToFree,Elm); //hash table update } else throw new TransportLayerException("UDP Error: port "+ PortToFree +" is not BUSY by the application: \"" + application.toString() + "\"."); } --- 488,493 ---- Elm.connectedtoPort=0; ! //PortTable.remove(PortToFree); //delete old element ! //PortTable.put(PortToFree,Elm); //hash table update } else throw new TransportLayerException("UDP Error: port "+ PortToFree +" is not BUSY by the application: \"" + application.toString() + "\"."); } *************** *** 513,527 **** if (inPort>=0 && inPort<=10000) { ! UDP_HashTableElement oldElm = null; ! ! if ( (UDP_HashTableElement)PortTable.get(inPort) !=null ) ! { ! oldElm = (UDP_HashTableElement)PortTable.get(inPort); ! switch(oldElm.PortStatus) { case 0: //port is free => update such a record in hashtable ! UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=1; Elm.application=application; --- 513,526 ---- if (inPort>=0 && inPort<=10000) { ! //UDP_HashTableElement oldElm = null; ! UDP_HashTableElement Elm = null; ! if ( (Elm =(UDP_HashTableElement)PortTable.get(inPort)) !=null ) ! { ! switch(Elm.PortStatus) { case 0: //port is free => update such a record in hashtable ! //UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=1; Elm.application=application; *************** *** 529,539 **** Elm.connectedtoPort=0; ! PortTable.remove(inPort); //delete old element ! PortTable.put(inPort,Elm); //hash table update break; case 1: // port is being listened to by whom? int UID1=-2; int UID2=-1; ! UID1=((Application)oldElm.application).getUID(); UID2=((Application)application).getUID(); --- 528,538 ---- Elm.connectedtoPort=0; ! //PortTable.remove(inPort); //delete old element ! //PortTable.put(inPort,Elm); //hash table update break; case 1: // port is being listened to by whom? int UID1=-2; int UID2=-1; ! UID1=((Application)Elm.application).getUID(); UID2=((Application)application).getUID(); *************** *** 552,560 **** { //create such a record in hashtable ! UDP_HashTableElement Elm = new UDP_HashTableElement(); ! Elm.PortStatus=1; ! Elm.application=application; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; PortTable.put(inPort,Elm); //hash table update --- 551,559 ---- { //create such a record in hashtable ! UDP_HashTableElement newElm = new UDP_HashTableElement(); ! newElm.PortStatus=1; ! newElm.application=application; ! newElm.connectedtoIP=""; ! newElm.connectedtoPort=0; PortTable.put(inPort,Elm); //hash table update |