Changeset f390831


Ignore:
Timestamp:
Apr 1, 2017 2:15:06 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
bfc0417
Parents:
5eefb8b2
Message:

Console: Fix stopping of webapps when console stops (ticket #1893)
i2psnark: Only rewrite torrent config file if changed (ticket #1893)
Util: Don't sync config writes on Android/ARM (ticket #1893)

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/Snark.java

    r5eefb8b2 rf390831  
    239239  // String indicating main activity
    240240  private volatile String activity = "Not started";
    241   private final long savedUploaded;
     241  private long savedUploaded;
    242242  private long _startedTime;
    243243  private static final AtomicInteger __RPCID = new AtomicInteger();
     
    638638        // TODO: Cache the config-in-mem to compare vs config-on-disk
    639639        // (needed for auto-save to not double-save in some cases)
    640         //boolean changed = storage.isChanged() || getUploaded() != savedUploaded;
    641         boolean changed = true;
    642         if (changed && completeListener != null)
    643             completeListener.updateStatus(this);
     640        long nowUploaded = getUploaded();
     641        boolean changed = storage.isChanged() || nowUploaded != savedUploaded;
    644642        try {
    645643            storage.close();
     
    648646            ioe.printStackTrace();
    649647        }
     648        savedUploaded = nowUploaded;
     649        if (changed && completeListener != null)
     650            completeListener.updateStatus(this);
    650651    }
    651652    if (fast)
     
    12901291    allChecked = true;
    12911292    checking = false;
    1292     if (storage.isChanged() && completeListener != null)
     1293    if (storage.isChanged() && completeListener != null) {
    12931294        completeListener.updateStatus(this);
     1295        // this saved the status, so reset the variables
     1296        storage.clearChanged();
     1297        savedUploaded = getUploaded();
     1298    }
    12941299  }
    12951300 
     
    13001305    //storage.close();
    13011306    //System.out.println("Completely received: " + torrent);
    1302     if (completeListener != null)
     1307    if (completeListener != null) {
    13031308        completeListener.torrentComplete(this);
     1309        // this saved the status, so reset the variables
     1310        savedUploaded = getUploaded();
     1311        storage.clearChanged();
     1312    }
    13041313  }
    13051314
  • apps/i2psnark/java/src/org/klomp/snark/Storage.java

    r5eefb8b2 rf390831  
    304304  public boolean isChanged() {
    305305      return changed;
     306  }
     307
     308  /**
     309   *  Clear the storage changed variable
     310   *  @since 0.9.30
     311   */
     312  void clearChanged() {
     313      changed = false;
    306314  }
    307315
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    r5eefb8b2 rf390831  
    1818import java.util.Map;
    1919import java.util.Properties;
     20import java.util.Set;
    2021import java.util.SortedSet;
    2122import java.util.StringTokenizer;
     
    234235        if (PluginStarter.pluginsEnabled(_context))
    235236            (new I2PAppThread(new PluginStopper(_context), "PluginStopper")).start();
     237        stopAllWebApps();
    236238        try {
    237239            _server.stop();
     
    10411043    }
    10421044
     1045    /**
     1046     *  Stops all but the root webapp (routerconsole.war)
     1047     *  In Jetty 9, stopping the server doesn't stop the non-root webapps,
     1048     *  so we must do it here.
     1049     *  There should be a better way to do this, possibly by
     1050     *  making the webapps "managed".
     1051     *  @since 0.9.30
     1052     */
     1053    private void stopAllWebApps() {
     1054        Properties props = webAppProperties(_context);
     1055        Set<String> keys = props.stringPropertyNames();
     1056        for (String name : keys) {
     1057            if (name.startsWith(PREFIX) && name.endsWith(ENABLED)) {
     1058                String app = name.substring(PREFIX.length(), name.lastIndexOf(ENABLED));
     1059                if (ROUTERCONSOLE.equals(app))
     1060                    continue;
     1061                if (WebAppStarter.isWebAppRunning(app)) {
     1062                    try {
     1063                        WebAppStarter.stopWebApp(app);
     1064                    } catch (Throwable t) { t.printStackTrace(); }
     1065                }
     1066            }
     1067        }
     1068
     1069    }
     1070
    10431071    static class WarFilenameFilter implements FilenameFilter {
    10441072        private static final WarFilenameFilter _filter = new WarFilenameFilter();
  • core/java/src/net/i2p/data/DataHelper.java

    r5eefb8b2 rf390831  
    4747import net.i2p.util.ReusableGZIPOutputStream;
    4848import net.i2p.util.SecureFileOutputStream;
     49import net.i2p.util.SystemVersion;
    4950import net.i2p.util.Translate;
    5051
     
    5556 */
    5657public class DataHelper {
     58
     59    /** See storeProps(). 600-750 ms on RPi. */
     60    private static final boolean SHOULD_SYNC = !(SystemVersion.isAndroid() || SystemVersion.isARM());
    5761
    5862    /**
     
    515519                out.println(name + "=" + val);
    516520            }
    517             out.flush();
    518             fos.getFD().sync();
     521            if (SHOULD_SYNC) {
     522                out.flush();
     523                fos.getFD().sync();
     524            }
    519525            out.close();
    520526            if (out.checkError()) {
  • history.txt

    r5eefb8b2 rf390831  
     12017-04-01 zzz
     2 * Console: Fix stopping of webapps when console stops (ticket #1893)
     3 * i2psnark: Only rewrite torrent config file if changed (ticket #1893)
     4 * KeyStoreUtil: Reduce log level of expired cert error
     5 * Util: Don't sync config writes on Android/ARM (ticket #1893)
     6
    172017-03-31 zzz
    28 * SSU:
     
    7884   - Update to Jetty 9.2.21.v20170120 and Tomcat 8.0.33 (tickets #1512, #1935)
    7985     Fixes jsp compilation on Java 9 (ticket #1870)
     86     Fixes InstanceManager warning (ticket #1818)
    8087     We now support servlet API 3.1, JSP API 2.3, and EL API 3.0.
    8188     Breaks the following plugins: bwschedule, i2pbote, i2pcontrol, zzzot
  • router/java/src/net/i2p/router/RouterVersion.java

    r5eefb8b2 rf390831  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 13;
     21    public final static long BUILD = 14;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.