Changeset 5372a50


Ignore:
Timestamp:
Sep 4, 2009 3:14:36 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1f1d089
Parents:
83588d9 (diff), e392469 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

propagate from branch 'i2p.i2p.zzz.test3' (head f18425568ef4ef20f5054f6fb133cf217bfab485)

to branch 'i2p.i2p' (head 36f4774eb9dd538b3a7c314de79a6fb3bc4df813)

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigKeyringHandler.java

    r83588d9 r5372a50  
    77
    88/**
    9  *  Support additions via B64 Destkey, B64 Desthash, or blahblah.i2p
     9 *  Support additions via B64 Destkey, B64 Desthash, blahblah.i2p, and others supported by ConvertToHash
    1010 */
    1111public class ConfigKeyringHandler extends FormHandler {
     
    1515    @Override
    1616    protected void processForm() {
    17         if ("Add key".equals(_action)) {
    18             if (_peer == null || _key == null) {
    19                 addFormError("You must enter a destination and a key");
     17        if (_action == null) return;
     18        boolean adding = _action.startsWith("Add");
     19        if (adding || _action.startsWith("Delete")) {
     20            if (_peer == null)
     21                addFormError("You must enter a destination");
     22            if (_key == null && adding)
     23                addFormError("You must enter a key");
     24            if (_peer == null || (_key == null && adding))
    2025                return;
    21             }
    2226            Hash h = ConvertToHash.getHash(_peer);
    23             SessionKey sk = new SessionKey();
    24             try {
    25                 sk.fromBase64(_key);
    26             } catch (DataFormatException dfe) {}
    27             if (h != null && h.getData() != null && sk.getData() != null) {
    28                 _context.keyRing().put(h, sk);
    29                 addFormNotice("Key for " + h.toBase64() + " added to keyring");
    30             } else {
    31                 addFormError("Invalid destination or key");
     27            if (adding) {
     28                SessionKey sk = new SessionKey();
     29                try {
     30                    sk.fromBase64(_key);
     31                } catch (DataFormatException dfe) {}
     32                if (h != null && h.getData() != null && sk.getData() != null) {
     33                    _context.keyRing().put(h, sk);
     34                    addFormNotice("Key for " + h.toBase64() + " added to keyring");
     35                } else {
     36                    addFormError("Invalid destination or key");
     37                }
     38            } else {  // Delete
     39                if (h != null && h.getData() != null) {
     40                    if (_context.keyRing().remove(h) != null)
     41                        addFormNotice("Key for " + h.toBase64() + " removed from keyring");
     42                    else
     43                        addFormNotice("Key for " + h.toBase64() + " not found in keyring");
     44                } else {
     45                    addFormError("Invalid destination");
     46                }
    3247            }
    3348        } else {
  • apps/routerconsole/jsp/configkeyring.jsp

    r83588d9 r5372a50  
    4141          <td><textarea name="peer" cols="44" rows="1" style="height: 3em;" wrap="off"></textarea></td>
    4242        </tr><tr>
    43           <td class="mediumtags" align="right">Session Key:</td>
     43          <td class="mediumtags" align="right">Encryption Key:</td>
    4444          <td><input type="text" size="55" name="key" /></td>
    4545        </tr><tr>
    46           <td></td>
    47           <td align="right"><input type="submit" name="action" value="Add key" /></td>
     46          <td align="right" colspan="2"><input type="submit" name="action" value="Add key" />
     47             <input type="submit" name="action" value="Delete key" /> <input type="reset" value="Cancel" /></td>
    4848</tr></table></div></form></div></div></body></html>
  • core/java/src/net/i2p/util/LogWriter.java

    r83588d9 r5372a50  
    197197        if (_rotationNum > max) _rotationNum = 0;
    198198
    199         return new File(replace(pattern, _rotationNum));
     199        String newf = replace(pattern, _rotationNum);
     200        if (base != null)
     201            return new File(base, newf);
     202        return new File(newf);
    200203    }
    201204
  • router/java/src/net/i2p/router/PersistentKeyRing.java

    r83588d9 r5372a50  
    6868    public void renderStatusHTML(Writer out) throws IOException {
    6969        StringBuilder buf = new StringBuilder(1024);
    70         buf.append("\n<table><tr><th align=\"left\">Destination Hash<th align=\"left\">Name or Dest.<th align=\"left\">Session Key</tr>");
     70        buf.append("\n<table><tr><th align=\"left\">Destination Hash<th align=\"left\">Name or Dest.<th align=\"left\">Encryption Key</tr>");
    7171        for (Entry<Hash, SessionKey> e : entrySet()) {
    7272            buf.append("\n<tr><td>");
  • router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java

    r83588d9 r5372a50  
    2929 */
    3030public class TunnelDispatcher implements Service {
    31     private RouterContext _context;
    32     private Log _log;
    33     private Map<TunnelId, TunnelGateway> _outboundGateways;
    34     private Map<TunnelId, OutboundTunnelEndpoint> _outboundEndpoints;
    35     private Map<TunnelId, TunnelParticipant> _participants;
    36     private Map<TunnelId, TunnelGateway> _inboundGateways;
    37     private Map<TunnelId, HopConfig> _participatingConfig;
     31    private final RouterContext _context;
     32    private final Log _log;
     33    private final Map<TunnelId, TunnelGateway> _outboundGateways;
     34    private final Map<TunnelId, OutboundTunnelEndpoint> _outboundEndpoints;
     35    private final Map<TunnelId, TunnelParticipant> _participants;
     36    private final Map<TunnelId, TunnelGateway> _inboundGateways;
     37    private final Map<TunnelId, HopConfig> _participatingConfig;
    3838    /** what is the date/time on which the last non-locally-created tunnel expires? */
    3939    private long _lastParticipatingExpiration;
    4040    private BloomFilterIVValidator _validator;
    41     private LeaveTunnel _leaveJob;
     41    private final LeaveTunnel _leaveJob;
    4242    /** what is the date/time we last deliberately dropped a tunnel? **/
    4343    private long _lastDropTime;
    44     private TunnelGatewayPumper _pumper;
     44    private final TunnelGatewayPumper _pumper;
    4545   
    4646    /** Creates a new instance of TunnelDispatcher */
     
    616616    }
    617617
    618     private static final int DROP_BASE_INTERVAL = 40 * 1000;
    619     private static final int DROP_RANDOM_BOOST = 10 * 1000;
     618    //private static final int DROP_BASE_INTERVAL = 40 * 1000;
     619    //private static final int DROP_RANDOM_BOOST = 10 * 1000;
    620620
    621621    /**
     
    623623     * the build executor may call this.
    624624     */
    625 
     625/*******
    626626    public void dropBiggestParticipating() {
    627627
     
    678678       _lastDropTime = _context.clock().now() + _context.random().nextInt(DROP_RANDOM_BOOST);
    679679    }
    680    
     680******/
     681
    681682    public void startup() {
    682683        // NB: 256 == assume max rate (size adjusted to handle 256 messages per second)
Note: See TracChangeset for help on using the changeset viewer.