Changeset 87d7e10


Ignore:
Timestamp:
Feb 22, 2016 1:04:57 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
eb094ba0
Parents:
7d35a4e
Message:

I2CP: Improve client error message when internal router connection fails

Location:
core/java/src/net/i2p/client/impl
Files:
2 edited

Legend:

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

    r7d35a4e r87d7e10  
    680680            throw new I2PSessionException(getPrefix() + "Cannot connect to the router on " + _hostname + ':' + _portNum, uhe);
    681681        } catch (IOException ioe) {
    682             throw new I2PSessionException(getPrefix() + "Cannot connect to the router on " + _hostname + ':' + _portNum, ioe);
     682            // Generate the best error message as this will be logged
     683            String msg;
     684            if (_context.isRouterContext())
     685                msg = "Failed to build tunnels";
     686            else if (SystemVersion.isAndroid() &&
     687                    Boolean.parseBoolean(_options.getProperty(PROP_DOMAIN_SOCKET)))
     688                msg = "Failed to bind to the router and build tunnels";
     689            else
     690                msg = "Cannot connect to the router on " + _hostname + ':' + _portNum + " and build tunnels";
     691            throw new I2PSessionException(getPrefix() + msg, ioe);
    683692        } finally {
    684693            if (success) {
  • core/java/src/net/i2p/client/impl/I2PSimpleSession.java

    r7d35a4e r87d7e10  
    3131import net.i2p.util.Log;
    3232import net.i2p.util.OrderedProperties;
     33import net.i2p.util.SystemVersion;
    3334
    3435/**
     
    141142            throw new I2PSessionException(getPrefix() + "Cannot connect to the router on " + _hostname + ':' + _portNum, uhe);
    142143        } catch (IOException ioe) {
    143             throw new I2PSessionException(getPrefix() + "Cannot connect to the router on " + _hostname + ':' + _portNum, ioe);
     144            // Generate the best error message as this will be logged
     145            String msg;
     146            if (_context.isRouterContext())
     147                msg = "Failed internal router binding";
     148            else if (SystemVersion.isAndroid() &&
     149                    Boolean.parseBoolean(getOptions().getProperty(PROP_DOMAIN_SOCKET)))
     150                msg = "Failed to bind to the router";
     151            else
     152                msg = "Cannot connect to the router on " + _hostname + ':' + _portNum;
     153            throw new I2PSessionException(getPrefix() + msg, ioe);
    144154        } finally {
    145155            changeState(success ? State.OPEN : State.CLOSED);
Note: See TracChangeset for help on using the changeset viewer.