When a peer connects to us, turn around and immediately connect back to them.

Don't wait up to 60 seconds for the next peer refresh interval.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5514 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-11-07 01:33:23 +00:00
parent 38e352443f
commit 01ac320432
2 changed files with 31 additions and 2 deletions
@@ -976,6 +976,24 @@ public abstract class PeerManager
return new PeerCreds(_nodeName, _sharedSecret);
}
/**
* Called when a peer connects to this server.
*/
protected void peerStartedSession (PeerSession session)
{
// this may be the first we've heard of this guy, so let's refresh our peers and
// potentially connect right back to him
refreshPeers();
}
/**
* Called when a peer's session with this server ends.
*/
protected void peerEndedSession (PeerSession session)
{
// nothing presently
}
/**
* Called when we have established a connection to the supplied peer.
*/
@@ -1234,8 +1252,7 @@ public abstract class PeerManager
// (this need not use a runqueue as all it will do is post an invoker unit)
protected Interval _peerRefresher = new Interval() {
@Override
public void expired () {
@Override public void expired () {
refreshPeers();
}
};