forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p' (head 156f8e6137be3c25aa70176fe0a78218b898a684)
to branch 'i2p.i2p.str4d.i2ptunnel' (head 126c1c30c0c02fd95719ffeae6d4709abb7bf18d)
This commit is contained in:
@@ -210,54 +210,15 @@ public class SummaryBarRenderer {
|
|||||||
.append(_("Network"))
|
.append(_("Network"))
|
||||||
.append(": ")
|
.append(": ")
|
||||||
.append(_helper.getReachability())
|
.append(_helper.getReachability())
|
||||||
.append("</a></h4><hr>\n");
|
.append("</a></h4><hr>\n")
|
||||||
|
|
||||||
|
|
||||||
// display all the time so we display the final failure message, and plugin update messages too
|
.append(_helper.getUpdateStatus())
|
||||||
String status = UpdateHandler.getStatus();
|
|
||||||
if (status.length() > 0) {
|
|
||||||
buf.append("<h4>").append(status).append("</h4><hr>\n");
|
|
||||||
}
|
|
||||||
if (_helper.updateAvailable() || _helper.unsignedUpdateAvailable()) {
|
|
||||||
if ("true".equals(System.getProperty(UpdateHandler.PROP_UPDATE_IN_PROGRESS))) {
|
|
||||||
// nothing
|
|
||||||
} else if(
|
|
||||||
// isDone() is always false for now, see UpdateHandler
|
|
||||||
// ((!update.isDone()) &&
|
|
||||||
_helper.getAction() == null &&
|
|
||||||
_helper.getUpdateNonce() == null &&
|
|
||||||
ConfigRestartBean.getRestartTimeRemaining() > 12*60*1000) {
|
|
||||||
long nonce = _context.random().nextLong();
|
|
||||||
String prev = System.getProperty("net.i2p.router.web.UpdateHandler.nonce");
|
|
||||||
if (prev != null)
|
|
||||||
System.setProperty("net.i2p.router.web.UpdateHandler.noncePrev", prev);
|
|
||||||
System.setProperty("net.i2p.router.web.UpdateHandler.nonce", nonce+"");
|
|
||||||
String uri = _helper.getRequestURI();
|
|
||||||
buf.append("<form action=\"").append(uri).append("\" method=\"POST\">\n");
|
|
||||||
buf.append("<input type=\"hidden\" name=\"updateNonce\" value=\"").append(nonce).append("\" >\n");
|
|
||||||
if (_helper.updateAvailable()) {
|
|
||||||
buf.append("<button type=\"submit\" class=\"download\" name=\"updateAction\" value=\"signed\" >")
|
|
||||||
// Note to translators: parameter is a version, e.g. "0.8.4"
|
|
||||||
.append(_("Download {0} Update", _helper.getUpdateVersion()))
|
|
||||||
.append("</button><br>\n");
|
|
||||||
}
|
|
||||||
if (_helper.unsignedUpdateAvailable()) {
|
|
||||||
buf.append("<button type=\"submit\" class=\"download\" name=\"updateAction\" value=\"Unsigned\" >")
|
|
||||||
// Note to translators: parameter is a date and time, e.g. "02-Mar 20:34 UTC"
|
|
||||||
// <br> is optional, to help the browser make the lines even in the button
|
|
||||||
// If the translation is shorter than the English, you should probably not include <br>
|
|
||||||
.append(_("Download Unsigned<br>Update {0}", _helper.getUnsignedUpdateVersion()))
|
|
||||||
.append("</button><br>\n");
|
|
||||||
}
|
|
||||||
buf.append("</form>\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
.append(_helper.getRestartStatus())
|
||||||
|
|
||||||
|
|
||||||
buf.append(ConfigRestartBean.renderStatus(_helper.getRequestURI(), _helper.getAction(), _helper.getConsoleNonce()))
|
|
||||||
|
|
||||||
.append("<hr><h3><a href=\"/peers\" target=\"_top\" title=\"")
|
.append("<hr><h3><a href=\"/peers\" target=\"_top\" title=\"")
|
||||||
.append(_("Show all current peer connections"))
|
.append(_("Show all current peer connections"))
|
||||||
.append("\">")
|
.append("\">")
|
||||||
@@ -451,7 +412,9 @@ public class SummaryBarRenderer {
|
|||||||
"</table><hr><h4>")
|
"</table><hr><h4>")
|
||||||
.append(_(_helper.getTunnelStatus()))
|
.append(_(_helper.getTunnelStatus()))
|
||||||
.append("</h4><hr>\n")
|
.append("</h4><hr>\n")
|
||||||
.append(_helper.getDestinations());
|
|
||||||
|
.append(_helper.getDestinations())
|
||||||
|
.append("<hr>\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import net.i2p.stat.RateStat;
|
|||||||
/**
|
/**
|
||||||
* Simple helper to query the appropriate router for data necessary to render
|
* Simple helper to query the appropriate router for data necessary to render
|
||||||
* the summary sections on the router console.
|
* the summary sections on the router console.
|
||||||
|
*
|
||||||
|
* For the full summary bar use renderSummaryBar()
|
||||||
*/
|
*/
|
||||||
public class SummaryHelper extends HelperBase {
|
public class SummaryHelper extends HelperBase {
|
||||||
|
|
||||||
@@ -412,7 +414,7 @@ public class SummaryHelper extends HelperBase {
|
|||||||
} else {
|
} else {
|
||||||
buf.append("<center><i>").append(_("none")).append("</i></center>");
|
buf.append("<center><i>").append(_("none")).append("</i></center>");
|
||||||
}
|
}
|
||||||
buf.append("</div><hr>\n");
|
buf.append("</div>\n");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,6 +606,62 @@ public class SummaryHelper extends HelperBase {
|
|||||||
return NewsFetcher.getInstance(_context).unsignedUpdateVersion();
|
return NewsFetcher.getInstance(_context).unsignedUpdateVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The update status and buttons
|
||||||
|
* @since 0.8.13 moved from SummaryBarRenderer
|
||||||
|
*/
|
||||||
|
public String getUpdateStatus() {
|
||||||
|
StringBuilder buf = new StringBuilder(512);
|
||||||
|
// display all the time so we display the final failure message, and plugin update messages too
|
||||||
|
String status = UpdateHandler.getStatus();
|
||||||
|
if (status.length() > 0) {
|
||||||
|
buf.append("<h4>").append(status).append("</h4><hr>\n");
|
||||||
|
}
|
||||||
|
if (updateAvailable() || unsignedUpdateAvailable()) {
|
||||||
|
if ("true".equals(System.getProperty(UpdateHandler.PROP_UPDATE_IN_PROGRESS))) {
|
||||||
|
// nothing
|
||||||
|
} else if(
|
||||||
|
// isDone() is always false for now, see UpdateHandler
|
||||||
|
// ((!update.isDone()) &&
|
||||||
|
getAction() == null &&
|
||||||
|
getUpdateNonce() == null &&
|
||||||
|
ConfigRestartBean.getRestartTimeRemaining() > 12*60*1000) {
|
||||||
|
long nonce = _context.random().nextLong();
|
||||||
|
String prev = System.getProperty("net.i2p.router.web.UpdateHandler.nonce");
|
||||||
|
if (prev != null)
|
||||||
|
System.setProperty("net.i2p.router.web.UpdateHandler.noncePrev", prev);
|
||||||
|
System.setProperty("net.i2p.router.web.UpdateHandler.nonce", nonce+"");
|
||||||
|
String uri = getRequestURI();
|
||||||
|
buf.append("<form action=\"").append(uri).append("\" method=\"POST\">\n");
|
||||||
|
buf.append("<input type=\"hidden\" name=\"updateNonce\" value=\"").append(nonce).append("\" >\n");
|
||||||
|
if (updateAvailable()) {
|
||||||
|
buf.append("<button type=\"submit\" class=\"download\" name=\"updateAction\" value=\"signed\" >")
|
||||||
|
// Note to translators: parameter is a version, e.g. "0.8.4"
|
||||||
|
.append(_("Download {0} Update", getUpdateVersion()))
|
||||||
|
.append("</button><br>\n");
|
||||||
|
}
|
||||||
|
if (unsignedUpdateAvailable()) {
|
||||||
|
buf.append("<button type=\"submit\" class=\"download\" name=\"updateAction\" value=\"Unsigned\" >")
|
||||||
|
// Note to translators: parameter is a date and time, e.g. "02-Mar 20:34 UTC"
|
||||||
|
// <br> is optional, to help the browser make the lines even in the button
|
||||||
|
// If the translation is shorter than the English, you should probably not include <br>
|
||||||
|
.append(_("Download Unsigned<br>Update {0}", getUnsignedUpdateVersion()))
|
||||||
|
.append("</button><br>\n");
|
||||||
|
}
|
||||||
|
buf.append("</form>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The restart status and buttons
|
||||||
|
* @since 0.8.13 moved from SummaryBarRenderer
|
||||||
|
*/
|
||||||
|
public String getRestartStatus() {
|
||||||
|
return ConfigRestartBean.renderStatus(getRequestURI(), getAction(), getConsoleNonce());
|
||||||
|
}
|
||||||
|
|
||||||
/** output the summary bar to _out */
|
/** output the summary bar to _out */
|
||||||
public void renderSummaryBar() throws IOException {
|
public void renderSummaryBar() throws IOException {
|
||||||
SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this);
|
SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this);
|
||||||
|
|||||||
52
build.xml
52
build.xml
@@ -443,50 +443,82 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="getReleaseNumber" >
|
<target name="getReleaseNumber" >
|
||||||
<exec executable="grep" outputproperty="versionLine" failonerror="true" >
|
<exec executable="grep" outputproperty="versionLine" failifexecutionfails="false" >
|
||||||
<arg value="public final static String VERSION" />
|
<arg value="public final static String VERSION" />
|
||||||
<arg value="core/java/src/net/i2p/CoreVersion.java" />
|
<arg value="core/java/src/net/i2p/CoreVersion.java" />
|
||||||
</exec>
|
</exec>
|
||||||
<exec executable="cut" osfamily="unix" inputstring="${versionLine}" outputproperty="release.number" failonerror="true" >
|
<property name="versionLine" value="unknown" />
|
||||||
|
<exec executable="cut" osfamily="unix" inputstring="${versionLine}" outputproperty="release.number" failifexecutionfails="false" >
|
||||||
<arg value="-f2" />
|
<arg value="-f2" />
|
||||||
<arg value="-d"" />
|
<arg value="-d"" />
|
||||||
</exec>
|
</exec>
|
||||||
<exec executable="cut" osfamily="mac" inputstring="${versionLine}" outputproperty="release.number" failonerror="true" >
|
<exec executable="cut" osfamily="mac" inputstring="${versionLine}" outputproperty="release.number" failifexecutionfails="false" >
|
||||||
<arg value="-f2" />
|
<arg value="-f2" />
|
||||||
<arg value="-d""/>
|
<arg value="-d""/>
|
||||||
</exec>
|
</exec>
|
||||||
<exec executable="cut" osfamily="windows" inputstring="${versionLine}" outputproperty="release.number" failonerror="true" >
|
<exec executable="cut" osfamily="windows" inputstring="${versionLine}" outputproperty="release.number" failifexecutionfails="false" >
|
||||||
<arg value="-f2" />
|
<arg value="-f2" />
|
||||||
<arg value="-d"\"""/>
|
<arg value="-d"\"""/>
|
||||||
</exec>
|
</exec>
|
||||||
|
<property name="release.number" value="unknown" />
|
||||||
<echo message="Release number is ${release.number}" />
|
<echo message="Release number is ${release.number}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="getBuildNumber" >
|
<target name="getBuildNumber" >
|
||||||
<exec executable="grep" outputproperty="buildLine" >
|
<exec executable="grep" outputproperty="buildLine" failifexecutionfails="false" >
|
||||||
<arg value="public final static long BUILD" />
|
<arg value="public final static long BUILD" />
|
||||||
<arg value="router/java/src/net/i2p/router/RouterVersion.java" />
|
<arg value="router/java/src/net/i2p/router/RouterVersion.java" />
|
||||||
</exec>
|
</exec>
|
||||||
<exec executable="cut" inputstring="${buildLine}" outputproperty="build.temp" failonerror="true" >
|
<property name="buildLine" value="??" />
|
||||||
|
<exec executable="cut" inputstring="${buildLine}" outputproperty="build.temp" failifexecutionfails="false" >
|
||||||
<arg value="-f2" />
|
<arg value="-f2" />
|
||||||
<arg value="-d=" />
|
<arg value="-d=" />
|
||||||
</exec>
|
</exec>
|
||||||
<exec executable="tr" inputstring="${build.temp}" outputproperty="build.temp.tr" failonerror="true">
|
<property name="build.temp" value="??" />
|
||||||
|
<exec executable="tr" inputstring="${build.temp}" outputproperty="build.temp.tr" failifexecutionfails="false">
|
||||||
<arg value="-d" />
|
<arg value="-d" />
|
||||||
<arg value=""[:space:]""/>
|
<arg value=""[:space:]""/>
|
||||||
</exec>
|
</exec>
|
||||||
<exec executable="cut" inputstring="${build.temp.tr}" outputproperty="build.number" failonerror="true" >
|
<property name="build.temp.tr" value="??" />
|
||||||
|
<exec executable="cut" inputstring="${build.temp.tr}" outputproperty="build.number" failifexecutionfails="false" >
|
||||||
<arg value="-f1" />
|
<arg value="-f1" />
|
||||||
<arg value="-d;" />
|
<arg value="-d;" />
|
||||||
</exec>
|
</exec>
|
||||||
<exec executable="awk" outputproperty="build.extra" failonerror="false">
|
<exec executable="awk" outputproperty="build.extra" failifexecutionfails="false">
|
||||||
<arg value="-F"" />
|
<arg value="-F"" />
|
||||||
<arg value="/public final static String EXTRA/{print $2}" />
|
<arg value="/public final static String EXTRA/{print $2}" />
|
||||||
<arg value="router/java/src/net/i2p/router/RouterVersion.java" />
|
<arg value="router/java/src/net/i2p/router/RouterVersion.java" />
|
||||||
</exec>
|
</exec>
|
||||||
|
<property name="build.number" value="??" />
|
||||||
|
<property name="build.extra" value="" />
|
||||||
<echo message="Build number is ${build.number}${build.extra}" />
|
<echo message="Build number is ${build.number}${build.extra}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="verifyReleaseBuildNumbers" depends="getReleaseNumber, getBuildNumber" >
|
||||||
|
<fail message="Bad release number: ${release.number}" >
|
||||||
|
<condition>
|
||||||
|
<or>
|
||||||
|
<equals arg1="${release.number}" arg2="unknown"/>
|
||||||
|
<equals arg1="${release.number}" arg2=""/>
|
||||||
|
</or>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
<fail message="Non-zero build number: ${build.number}" >
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<equals arg1="${build.number}" arg2="0"/>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
<fail message="Non-empty extra build: ${build.extra}" >
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<equals arg1="${build.extra}" arg2=""/>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="clean" depends="pkgclean" >
|
<target name="clean" depends="pkgclean" >
|
||||||
<delete dir="./build" />
|
<delete dir="./build" />
|
||||||
<delete file="installer/lib/izpack/patches.jar" failonerror="false" quiet="true" />
|
<delete file="installer/lib/izpack/patches.jar" failonerror="false" quiet="true" />
|
||||||
@@ -1235,7 +1267,7 @@
|
|||||||
<!--
|
<!--
|
||||||
<target name="release" depends="distclean, updaterWithJettyFixesAndJbigi , updater200WithJettyFixes, preppkg, installer, getReleaseNumber" >
|
<target name="release" depends="distclean, updaterWithJettyFixesAndJbigi , updater200WithJettyFixes, preppkg, installer, getReleaseNumber" >
|
||||||
-->
|
-->
|
||||||
<target name="release" depends="distclean, testscripts, updater, updater200, preppkg, installer, getReleaseNumber" >
|
<target name="release" depends="verifyReleaseBuildNumbers, distclean, testscripts, updater, updater200, preppkg, installer" >
|
||||||
<echo message="================================================================" />
|
<echo message="================================================================" />
|
||||||
<echo message="Did you update these files?" />
|
<echo message="Did you update these files?" />
|
||||||
<exec executable="ls" failonerror="true">
|
<exec executable="ls" failonerror="true">
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
2012-01-22 zzz
|
||||||
|
* Transports: Bind only to a single interface if specified
|
||||||
|
as the host address and it's available (ticket #591)
|
||||||
|
* VMCommSystem: Move to dummy directory
|
||||||
|
|
||||||
|
2012-01-21 zzz
|
||||||
|
* Build: Fix Windows build, version checking for release
|
||||||
|
* Console summary bar: Move some code around
|
||||||
|
|
||||||
2012-01-20 sponge
|
2012-01-20 sponge
|
||||||
* Fix too short of delay for http. It is up to the browser to time out
|
* Fix too short of delay for http. It is up to the browser to time out
|
||||||
in a shorter time, not the proxy. This is wreaking havoc on large
|
in a shorter time, not the proxy. This is wreaking havoc on large
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import net.i2p.router.peermanager.ProfileOrganizer;
|
|||||||
import net.i2p.router.transport.CommSystemFacadeImpl;
|
import net.i2p.router.transport.CommSystemFacadeImpl;
|
||||||
import net.i2p.router.transport.FIFOBandwidthLimiter;
|
import net.i2p.router.transport.FIFOBandwidthLimiter;
|
||||||
import net.i2p.router.transport.OutboundMessageRegistry;
|
import net.i2p.router.transport.OutboundMessageRegistry;
|
||||||
import net.i2p.router.transport.VMCommSystem;
|
|
||||||
import net.i2p.router.tunnel.TunnelDispatcher;
|
import net.i2p.router.tunnel.TunnelDispatcher;
|
||||||
import net.i2p.router.tunnel.pool.TunnelPoolManager;
|
import net.i2p.router.tunnel.pool.TunnelPoolManager;
|
||||||
import net.i2p.util.Clock;
|
import net.i2p.util.Clock;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 6;
|
public final static long BUILD = 7;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package net.i2p.router.transport;
|
package net.i2p.router.dummy;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@@ -13,6 +13,7 @@ import java.util.Comparator;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
@@ -30,6 +31,7 @@ import net.i2p.router.transport.CommSystemFacadeImpl;
|
|||||||
import net.i2p.router.transport.Transport;
|
import net.i2p.router.transport.Transport;
|
||||||
import net.i2p.router.transport.TransportBid;
|
import net.i2p.router.transport.TransportBid;
|
||||||
import net.i2p.router.transport.TransportImpl;
|
import net.i2p.router.transport.TransportImpl;
|
||||||
|
import net.i2p.util.Addresses;
|
||||||
import net.i2p.util.ConcurrentHashSet;
|
import net.i2p.util.ConcurrentHashSet;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
import net.i2p.util.Translate;
|
import net.i2p.util.Translate;
|
||||||
@@ -515,6 +517,23 @@ public class NTCPTransport extends TransportImpl {
|
|||||||
if (_myAddress != null) {
|
if (_myAddress != null) {
|
||||||
InetAddress bindToAddr = null;
|
InetAddress bindToAddr = null;
|
||||||
String bindTo = _context.getProperty(PROP_BIND_INTERFACE);
|
String bindTo = _context.getProperty(PROP_BIND_INTERFACE);
|
||||||
|
|
||||||
|
if (bindTo == null) {
|
||||||
|
// If we are configured with a fixed IP address,
|
||||||
|
// AND it's one of our local interfaces,
|
||||||
|
// bind only to that.
|
||||||
|
boolean isFixed = _context.getProperty(CommSystemFacadeImpl.PROP_I2NP_NTCP_AUTO_IP, "true")
|
||||||
|
.toLowerCase(Locale.US).equals("false");
|
||||||
|
String fixedHost = _context.getProperty(CommSystemFacadeImpl.PROP_I2NP_NTCP_HOSTNAME);
|
||||||
|
if (isFixed && fixedHost != null) {
|
||||||
|
try {
|
||||||
|
String testAddr = InetAddress.getByName(fixedHost).getHostAddress();
|
||||||
|
if (Addresses.getAddresses().contains(testAddr))
|
||||||
|
bindTo = testAddr;
|
||||||
|
} catch (UnknownHostException uhe) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bindTo != null) {
|
if (bindTo != null) {
|
||||||
try {
|
try {
|
||||||
bindToAddr = InetAddress.getByName(bindTo);
|
bindToAddr = InetAddress.getByName(bindTo);
|
||||||
@@ -532,10 +551,13 @@ public class NTCPTransport extends TransportImpl {
|
|||||||
chan.configureBlocking(false);
|
chan.configureBlocking(false);
|
||||||
|
|
||||||
InetSocketAddress addr = null;
|
InetSocketAddress addr = null;
|
||||||
if(bindToAddr==null)
|
if(bindToAddr==null) {
|
||||||
addr = new InetSocketAddress(_myAddress.getPort());
|
addr = new InetSocketAddress(_myAddress.getPort());
|
||||||
else
|
} else {
|
||||||
addr = new InetSocketAddress(bindToAddr, _myAddress.getPort());
|
addr = new InetSocketAddress(bindToAddr, _myAddress.getPort());
|
||||||
|
if (_log.shouldLog(Log.WARN))
|
||||||
|
_log.warn("Binding only to " + bindToAddr);
|
||||||
|
}
|
||||||
chan.socket().bind(addr);
|
chan.socket().bind(addr);
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Listening on " + addr);
|
_log.info("Listening on " + addr);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import net.i2p.router.transport.Transport;
|
|||||||
import net.i2p.router.transport.TransportBid;
|
import net.i2p.router.transport.TransportBid;
|
||||||
import net.i2p.router.transport.TransportImpl;
|
import net.i2p.router.transport.TransportImpl;
|
||||||
import net.i2p.router.util.RandomIterator;
|
import net.i2p.router.util.RandomIterator;
|
||||||
|
import net.i2p.util.Addresses;
|
||||||
import net.i2p.util.ConcurrentHashSet;
|
import net.i2p.util.ConcurrentHashSet;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
import net.i2p.util.SimpleScheduler;
|
import net.i2p.util.SimpleScheduler;
|
||||||
@@ -255,6 +256,21 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
|
|
||||||
// bind host
|
// bind host
|
||||||
String bindTo = _context.getProperty(PROP_BIND_INTERFACE);
|
String bindTo = _context.getProperty(PROP_BIND_INTERFACE);
|
||||||
|
|
||||||
|
if (bindTo == null) {
|
||||||
|
// If we are configured with a fixed IP address,
|
||||||
|
// AND it's one of our local interfaces,
|
||||||
|
// bind only to that.
|
||||||
|
String fixedHost = _context.getProperty(PROP_EXTERNAL_HOST);
|
||||||
|
if (fixedHost != null && fixedHost.length() > 0) {
|
||||||
|
try {
|
||||||
|
String testAddr = InetAddress.getByName(fixedHost).getHostAddress();
|
||||||
|
if (Addresses.getAddresses().contains(testAddr))
|
||||||
|
bindTo = testAddr;
|
||||||
|
} catch (UnknownHostException uhe) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InetAddress bindToAddr = null;
|
InetAddress bindToAddr = null;
|
||||||
if (bindTo != null) {
|
if (bindTo != null) {
|
||||||
try {
|
try {
|
||||||
@@ -281,6 +297,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
} else {
|
} else {
|
||||||
port = _externalListenPort;
|
port = _externalListenPort;
|
||||||
}
|
}
|
||||||
|
if (bindToAddr != null && _log.shouldLog(Log.WARN))
|
||||||
|
_log.warn("Binding only to " + bindToAddr);
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Binding to the port: " + port);
|
_log.info("Binding to the port: " + port);
|
||||||
if (_endpoint == null) {
|
if (_endpoint == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user