[Udt-java-commits] SF.net SVN: udt-java:[41] udt-java/trunk/src/main/java/udt
Status: Alpha
Brought to you by:
bschuller
From: <bsc...@us...> - 2010-06-18 06:35:32
|
Revision: 41 http://udt-java.svn.sourceforge.net/udt-java/?rev=41&view=rev Author: bschuller Date: 2010-06-18 06:35:25 +0000 (Fri, 18 Jun 2010) Log Message: ----------- add another constructor to UDPEndpoint Modified Paths: -------------- udt-java/trunk/src/main/java/udt/UDPEndPoint.java udt-java/trunk/src/main/java/udt/UDTCongestionControl.java Modified: udt-java/trunk/src/main/java/udt/UDPEndPoint.java =================================================================== --- udt-java/trunk/src/main/java/udt/UDPEndPoint.java 2010-05-29 18:43:46 UTC (rev 40) +++ udt-java/trunk/src/main/java/udt/UDPEndPoint.java 2010-06-18 06:35:25 UTC (rev 41) @@ -66,17 +66,18 @@ private final DatagramSocket dgSocket; //active sessions keyed by socket ID - private final Map<Long,UDTSession>sessions; + private final Map<Long,UDTSession>sessions=new ConcurrentHashMap<Long, UDTSession>(); //connecting sessions keyed by peer destination - private final Map<Destination,UDTSession>clientSessions; + private final Map<Destination,UDTSession>clientSessions=new ConcurrentHashMap<Destination, UDTSession>();; //last received packet private UDTPacket lastPacket; //if the endpoint is configured for a server socket, //this queue is used to handoff new UDTSessions to the application - private final SynchronousQueue<UDTSession> sessionHandoff; + private final SynchronousQueue<UDTSession> sessionHandoff=new SynchronousQueue<UDTSession>(); + private boolean serverSocketMode=false; //has the endpoint been stopped? @@ -85,6 +86,16 @@ public static final int DATAGRAM_SIZE=1500; /** + * create an endpoint on the given socket + * + * @param socket - a UDP datagram socket + */ + public UDPEndPoint(DatagramSocket socket){ + this.dgSocket=socket; + port=dgSocket.getLocalPort(); + } + + /** * bind to any local port on the given host address * @param localAddress * @throws SocketException @@ -109,9 +120,7 @@ } if(localPort>0)this.port = localPort; else port=dgSocket.getLocalPort(); - sessions=new ConcurrentHashMap<Long, UDTSession>(); - clientSessions=new ConcurrentHashMap<Destination, UDTSession>(); - sessionHandoff=new SynchronousQueue<UDTSession>(); + //set a time out to avoid blocking in doReceive() dgSocket.setSoTimeout(100000); //buffer size Modified: udt-java/trunk/src/main/java/udt/UDTCongestionControl.java =================================================================== --- udt-java/trunk/src/main/java/udt/UDTCongestionControl.java 2010-05-29 18:43:46 UTC (rev 40) +++ udt-java/trunk/src/main/java/udt/UDTCongestionControl.java 2010-06-18 06:35:25 UTC (rev 41) @@ -72,7 +72,7 @@ * @see udt.CongestionControl#init() */ public void init() { - setAckInterval(10); + } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |