Changeset da4ea77


Ignore:
Timestamp:
Oct 18, 2012 2:20:39 AM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
2b50c5a
Parents:
af4786c
Message:

more fixes

Location:
apps/routerconsole/java/src/net/i2p/router/update
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/update/ConsoleUpdateManager.java

    raf4786c rda4ea77  
    107107
    108108        _context.registerUpdateManager(this);
    109         Updater u = new DummyHandler(_context);
    110         register(u, TYPE_DUMMY, HTTP, 0);
     109        DummyHandler dh = new DummyHandler(_context);
     110        register((Checker)dh, TYPE_DUMMY, HTTP, 0);
     111        register((Updater)dh, TYPE_DUMMY, HTTP, 0);
    111112        // register news before router, so we don't fire off an update
    112113        // right at instantiation if the news is already indicating a new version
     
    114115        register(c, NEWS, HTTP, 0);
    115116        register(c, ROUTER_SIGNED, HTTP, 0);  // news is an update checker for the router
    116         u = new UpdateHandler(_context);
     117        Updater u = new UpdateHandler(_context);
    117118        register(u, ROUTER_SIGNED, HTTP, 0);
    118119        UnsignedUpdateHandler uuh = new UnsignedUpdateHandler(_context);
     
    181182        }
    182183        return null;
     184    }
     185
     186    /**
     187     *  Fire off a checker task
     188     *  Non-blocking.
     189     */
     190    public void check(UpdateType type) {
     191        check(type, "");
    183192    }
    184193
     
    646655            task.notifyAll();
    647656        }
    648 // TODO
    649657    }
    650658
  • apps/routerconsole/java/src/net/i2p/router/update/NewsTimerTask.java

    raf4786c rda4ea77  
    5656    public void timeReached() {
    5757        if (shouldFetchNews()) {
     58            // blocking
    5859            fetchNews();
    59             if (shouldFetchUnsigned())
    60                 fetchUnsignedHead();
     60            if (shouldFetchUnsigned()) {
     61                // give it a sec for the download to kick in, if it's going to
     62                try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
     63                if (!_mgr.isCheckInProgress() && !_mgr.isUpdateInProgress())
     64                    // nonblocking
     65                    fetchUnsignedHead();
     66            }
    6167        }
    6268    }
     
    6571        if (_context.router().gracefulShutdownInProgress())
    6672            return false;
    67         if (NewsHelper.isUpdateInProgress())
     73        if (_mgr.isCheckInProgress() || _mgr.isUpdateInProgress())
    6874            return false;
    6975        long lastFetch = NewsHelper.lastChecked(_context);
     
    8995    }
    9096
     97    /** blocking */
    9198    private void fetchNews() {
    92         _mgr.check(NEWS, "");
     99        _mgr.checkAvailable(NEWS, 60*1000);
    93100    }
    94101   
     
    103110     * HEAD the update url, and if the last-mod time is newer than the last update we
    104111     * downloaded, as stored in the properties, then we download it using eepget.
     112     *
     113     * Non-blocking
    105114     */
    106115    private void fetchUnsignedHead() {
    107         _mgr.check(ROUTER_UNSIGNED, "");
     116        _mgr.check(ROUTER_UNSIGNED);
    108117    }
    109118}
Note: See TracChangeset for help on using the changeset viewer.