forked from I2P_Developers/i2p.i2p
concurrent, final
This commit is contained in:
@ -78,7 +78,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
|||||||
private static long __tunnelId = 0;
|
private static long __tunnelId = 0;
|
||||||
private final long _tunnelId;
|
private final long _tunnelId;
|
||||||
private final Properties _clientOptions;
|
private final Properties _clientOptions;
|
||||||
private final List<I2PSession> _sessions;
|
private final Set<I2PSession> _sessions;
|
||||||
|
|
||||||
public static final int PACKET_DELAY = 100;
|
public static final int PACKET_DELAY = 100;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
|||||||
// as of 0.8.4, include context properties
|
// as of 0.8.4, include context properties
|
||||||
Properties p = _context.getProperties();
|
Properties p = _context.getProperties();
|
||||||
_clientOptions = p;
|
_clientOptions = p;
|
||||||
_sessions = new ArrayList(1);
|
_sessions = new CopyOnWriteArraySet();
|
||||||
|
|
||||||
addConnectionEventListener(lsnr);
|
addConnectionEventListener(lsnr);
|
||||||
boolean gui = true;
|
boolean gui = true;
|
||||||
@ -192,22 +192,17 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
|||||||
|
|
||||||
/** @return non-null */
|
/** @return non-null */
|
||||||
List<I2PSession> getSessions() {
|
List<I2PSession> getSessions() {
|
||||||
synchronized (_sessions) {
|
|
||||||
return new ArrayList(_sessions);
|
return new ArrayList(_sessions);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addSession(I2PSession session) {
|
void addSession(I2PSession session) {
|
||||||
if (session == null) return;
|
if (session == null) return;
|
||||||
synchronized (_sessions) {
|
_sessions.add(session);
|
||||||
if (!_sessions.contains(session))
|
|
||||||
_sessions.add(session);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeSession(I2PSession session) {
|
void removeSession(I2PSession session) {
|
||||||
if (session == null) return;
|
if (session == null) return;
|
||||||
synchronized (_sessions) {
|
_sessions.remove(session);
|
||||||
_sessions.remove(session);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Properties getClientOptions() { return _clientOptions; }
|
public Properties getClientOptions() { return _clientOptions; }
|
||||||
|
@ -28,10 +28,10 @@ import net.i2p.util.SecureFileOutputStream;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TunnelController implements Logging {
|
public class TunnelController implements Logging {
|
||||||
private Log _log;
|
private final Log _log;
|
||||||
private Properties _config;
|
private Properties _config;
|
||||||
private I2PTunnel _tunnel;
|
private final I2PTunnel _tunnel;
|
||||||
private List<String> _messages;
|
private final List<String> _messages;
|
||||||
private List<I2PSession> _sessions;
|
private List<I2PSession> _sessions;
|
||||||
private boolean _running;
|
private boolean _running;
|
||||||
private boolean _starting;
|
private boolean _starting;
|
||||||
|
Reference in New Issue
Block a user