Changeset 6d2270a for apps


Ignore:
Timestamp:
Mar 28, 2019 3:32:49 PM (20 months ago)
Author:
zab2 <zab2@…>
Branches:
master
Children:
fd6cb07
Parents:
94bde1d
Message:

Cancel timers if tunnel is stopped

Location:
apps/i2ptunnel/java/src/net/i2p/i2ptunnel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java

    r94bde1d r6d2270a  
    229229            I2PAppContext context = getTunnel().getContext();
    230230            try {
    231                 filter = FilterFactory.createFilter(context, filterDefinition);
     231                filter = FilterFactory.createFilter(context, filterDefinition, this);
    232232            } catch (IOException | InvalidDefinitionException bad) {
    233233                throw new IllegalArgumentException("Can't create socket manager", bad);
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/AccessFilter.java

    r94bde1d r6d2270a  
    1818import net.i2p.util.Log;
    1919import net.i2p.data.Destination;
     20import net.i2p.i2ptunnel.I2PTunnelTask;
    2021import net.i2p.client.streaming.IncomingConnectionFilter;
    2122
     
    2728    private final FilterDefinition definition;
    2829    private final I2PAppContext context;
     30    private final I2PTunnelTask task;
    2931
    3032    /**
     
    3739    private final Map<String, DestTracker> unknownDests = new HashMap<String, DestTracker>();
    3840
    39     AccessFilter(I2PAppContext context, FilterDefinition definition) throws IOException {
     41    AccessFilter(I2PAppContext context, FilterDefinition definition, I2PTunnelTask task)
     42            throws IOException {
    4043        this.context = context;
    4144        this.definition = definition;
     45        this.task = task;
    4246
    4347        reload();
     
    140144        }
    141145        public void timeReached() {
     146            if (!task.isOpen())
     147                return;
    142148            purge();
    143149            schedule(PURGE_INTERVAL);
     
    150156        }
    151157        public void timeReached() {
     158            if (!task.isOpen())
     159                return;
    152160            try {
    153161                record();
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/access/FilterFactory.java

    r94bde1d r6d2270a  
    1010
    1111import net.i2p.I2PAppContext;
     12import net.i2p.i2ptunnel.I2PTunnelTask;
    1213import net.i2p.client.streaming.IncomingConnectionFilter;
    1314
    1415public class FilterFactory {
    15     public static IncomingConnectionFilter createFilter(I2PAppContext context, File definition)
     16    public static IncomingConnectionFilter createFilter(I2PAppContext context,
     17                                                        File definition,
     18                                                        I2PTunnelTask task)
    1619        throws IOException, InvalidDefinitionException {
    1720        List<String> linesList = new ArrayList<String>();
     
    3437
    3538        FilterDefinition parsedDefinition = DefinitionParser.parse(linesList.toArray(new String[0]));
    36         return new AccessFilter(context, parsedDefinition);
     39        return new AccessFilter(context, parsedDefinition, task);
    3740    }
    3841}
Note: See TracChangeset for help on using the changeset viewer.