use of net.i2p.client.streaming.I2PSocketManager in project i2p.i2p by i2p.
the class I2PTunnelClientBase method optionsUpdated.
/**
* Update the I2PSocketManager.
*
* @since 0.9.1
*/
@Override
public void optionsUpdated(I2PTunnel tunnel) {
if (getTunnel() != tunnel)
return;
I2PSocketManager sm = _ownDest ? sockMgr : socketManager;
if (sm == null)
return;
Properties props = tunnel.getClientOptions();
sm.setDefaultOptions(sm.buildOptions(props));
}
use of net.i2p.client.streaming.I2PSocketManager in project i2p.i2p by i2p.
the class I2PSnarkUtil method connect.
/**
* connect to the given destination
*/
I2PSocket connect(PeerID peer) throws IOException {
I2PSocketManager mgr = _manager;
if (mgr == null)
throw new IOException("No socket manager");
Destination addr = peer.getAddress();
if (addr == null)
throw new IOException("Null address");
if (addr.equals(getMyDestination()))
throw new IOException("Attempt to connect to myself");
Hash dest = addr.calculateHash();
if (_banlist.contains(dest))
throw new IOException("Not trying to contact " + dest.toBase64() + ", as they are banlisted");
try {
// TODO opts.setPort(xxx); connect(addr, opts)
// DHT moved above 6881 in 0.9.9
I2PSocket rv = _manager.connect(addr);
if (rv != null)
_banlist.remove(dest);
return rv;
} catch (I2PException ie) {
_banlist.add(dest);
_context.simpleTimer2().addEvent(new Unbanlist(dest), 10 * 60 * 1000);
IOException ioe = new IOException("Unable to reach the peer " + peer);
ioe.initCause(ie);
throw ioe;
}
}
Aggregations