* ministreaming:

- small pedantic fix
    * streaming:
      - Fix a deadly race condition.
      - Some small pedantic fixes.
    * core:
      - Fix a deadly race condition.
    * BOB:
      - Fixed some races that occured from fixing races in streaming and core.
      - Some badly needed code refactoring to depend less on the database.
This commit is contained in:
sponge
2009-07-16 03:03:33 +00:00
parent 5d40ad1749
commit 5106c37ac4
18 changed files with 1157 additions and 1078 deletions

View File

@ -20,15 +20,15 @@ class I2PServerSocketImpl implements I2PServerSocket {
private final static Log _log = new Log(I2PServerSocketImpl.class);
private I2PSocketManager mgr;
/** list of sockets waiting for the client to accept them */
private List<I2PSocket> pendingSockets = Collections.synchronizedList(new ArrayList<I2PSocket>(4));
private final List<I2PSocket> pendingSockets = Collections.synchronizedList(new ArrayList<I2PSocket>(4));
/** have we been closed */
private volatile boolean closing = false;
/** lock on this when accepting a pending socket, and wait on it for notification of acceptance */
private Object socketAcceptedLock = new Object();
private final Object socketAcceptedLock = new Object();
/** lock on this when adding a new socket to the pending list, and wait on it accordingly */
private Object socketAddedLock = new Object();
private final Object socketAddedLock = new Object();
/**
* Set Sock Option accept timeout stub, does nothing in ministreaming

View File

@ -40,15 +40,15 @@ import net.i2p.util.Log;
class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
private I2PAppContext _context;
private Log _log;
private I2PSession _session;
private /* final */ I2PSession _session;
private I2PServerSocketImpl _serverSocket = null;
private Object lock = new Object(); // for locking socket lists
private final Object lock = new Object(); // for locking socket lists
private HashMap<String,I2PSocket> _outSockets;
private HashMap<String,I2PSocket> _inSockets;
private I2PSocketOptions _defaultOptions;
private long _acceptTimeout;
private String _name;
private List<DisconnectListener> _listeners;
private final List<DisconnectListener> _listeners = new ArrayList<DisconnectListener>(1);;
private static int __managerId = 0;
public static final short ACK = 0x51;
@ -79,7 +79,7 @@ class I2PSocketManagerImpl implements I2PSocketManager, I2PSessionListener {
_inSockets = new HashMap<String,I2PSocket>(16);
_outSockets = new HashMap<String,I2PSocket>(16);
_acceptTimeout = ACCEPT_TIMEOUT_DEFAULT;
_listeners = new ArrayList<DisconnectListener>(1);
// _listeners = new ArrayList<DisconnectListener>(1);
setSession(session);
setDefaultOptions(buildOptions(opts));
_context.statManager().createRateStat("streaming.lifetime", "How long before the socket is closed?", "streaming", new long[] { 10*60*1000, 60*60*1000, 24*60*60*1000 });