Changeset 7aaed8e


Ignore:
Timestamp:
Oct 19, 2008 9:41:07 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
2d6007cf
Parents:
e2a1835
Message:
  • Client: Prevent a race causing session reconnect
File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/client/I2PSessionImpl.java

    re2a1835 r7aaed8e  
    9393    private boolean _closed;
    9494
     95    /** whether the session connection is in the process of being closed */
     96    private boolean _closing;
     97
    9598    /** have we received the current date from the router yet? */
    9699    private boolean _dateReceived;
     
    126129        _handlerMap = new I2PClientMessageHandlerMap(context);
    127130        _closed = true;
     131        _closing = false;
    128132        _producer = new I2CPMessageProducer(context);
    129133        _availabilityNotifier = new AvailabilityNotifier();
     
    565569       
    566570        if (_log.shouldLog(Log.INFO)) _log.info(getPrefix() + "Destroy the session", new Exception("DestroySession()"));
     571        _closing = true;   // we use this to prevent a race
    567572        if (sendDisconnect) {
    568573            try {
     
    574579        _availabilityNotifier.stopNotifying();
    575580        _closed = true;
     581        _closing = false;
    576582        closeSocket();
    577583        if (_sessionListener != null) _sessionListener.disconnected(this);
     
    608614
    609615    protected void disconnect() {
    610         if (_closed) return;
     616        if (_closed || _closing) return;
    611617        if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Disconnect() called", new Exception("Disconnect"));
    612618        if (shouldReconnect()) {
Note: See TracChangeset for help on using the changeset viewer.