propagate from branch 'i2p.i2p.zzz.test' (head d4e23b124489f9a3dd9410aa941e88823702b950)

to branch 'i2p.i2p' (head 7a54e1c58b8cf2ad43830ddec6d404229e3e6e60)
This commit is contained in:
zzz
2009-01-17 17:33:17 +00:00
4 changed files with 20 additions and 4 deletions

View File

@ -75,7 +75,7 @@
with "SSU introductions" - peers who will relay a request from someone you don't know to your
router for your router so that you can make an outbound connection to them. I2P will use these
introductions automatically if it detects that the port is not forwarded (as shown by
the <i>Status: OK (NAT)</i> line), or you can manually require them here.
the <i>Status: Firewalled</i> line), or you can manually require them here.
Users behind symmetric NATs, such as OpenBSD's pf, are not currently supported.</p>
<input type="submit" name="recheckReachability" value="Check network reachability..." />
<hr />

View File

@ -285,9 +285,10 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
_log.warn("Halting NTCP to change address");
t.stopListening();
newAddr.setOptions(newProps);
// Give NTCP Pumper time to stop so we don't end up with two...
// Need better way
try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
// Wait for NTCP Pumper to stop so we don't end up with two...
while (t.isAlive()) {
try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
}
t.restartListening(newAddr);
_log.warn("Changed NTCP Address and started up, address is now " + newAddr);
return;

View File

@ -85,6 +85,13 @@ public class EventPumper implements Runnable {
_selector.wakeup();
}
/**
* Selector can take quite a while to close after calling stopPumping()
*/
public boolean isAlive() {
return _alive || (_selector != null && _selector.isOpen());
}
public void register(ServerSocketChannel chan) {
if (_log.shouldLog(Log.DEBUG)) _log.debug("Registering server socket channel");
synchronized (_wantsRegister) { _wantsRegister.add(chan); }

View File

@ -432,6 +432,10 @@ public class NTCPTransport extends TransportImpl {
return bindAddress();
}
public boolean isAlive() {
return _pumper.isAlive();
}
private RouterAddress bindAddress() {
if (_myAddress != null) {
try {
@ -538,6 +542,10 @@ public class NTCPTransport extends TransportImpl {
}
}
/**
* This doesn't (completely) block, caller should check isAlive()
* before calling startListening() or restartListening()
*/
public void stopListening() {
if (_log.shouldLog(Log.DEBUG)) _log.debug("Stopping ntcp transport");
_pumper.stopPumping();