diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java index d33980e6437f90a3daeb161288739e14454b226f..1b3442ee1b561469f566e01b909ee194c20f226a 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCClient.java @@ -137,7 +137,18 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase { if (clientDest == null) throw new UnknownHostException("Could not resolve " + addr.getHostName()); int port = addr.getPort(); - i2ps = createI2PSocket(clientDest, port); + try { + i2ps = createI2PSocket(clientDest, port); + } catch (RuntimeException re) { + // tunnel build failure + _log.error("Error connecting", re); + try { + String name = addr != null ? addr.getHostName() : "undefined"; + String msg = ":" + name + " 499 you :" + re.getMessage() + "\r\n"; + s.getOutputStream().write(DataHelper.getUTF8(msg)); + } catch (IOException ioe) {} + throw re; + } i2ps.setReadTimeout(readTimeout); StringBuffer expectedPong = new StringBuffer(); DCCHelper dcc = _dccEnabled ? new DCC(s.getLocalAddress().getAddress()) : null;