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:
@@ -976,6 +976,24 @@ public abstract class PeerManager
|
|||||||
return new PeerCreds(_nodeName, _sharedSecret);
|
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.
|
* 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)
|
// (this need not use a runqueue as all it will do is post an invoker unit)
|
||||||
protected Interval _peerRefresher = new Interval() {
|
protected Interval _peerRefresher = new Interval() {
|
||||||
@Override
|
@Override public void expired () {
|
||||||
public void expired () {
|
|
||||||
refreshPeers();
|
refreshPeers();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,6 +82,18 @@ public class PeerSession extends PresentsSession
|
|||||||
|
|
||||||
// save the client oid so we know it even after the object itself is cleared out
|
// save the client oid so we know it even after the object itself is cleared out
|
||||||
_cloid = _clobj.getOid();
|
_cloid = _clobj.getOid();
|
||||||
|
|
||||||
|
// let the peer manager know that we're here
|
||||||
|
_peermgr.peerStartedSession(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // documentation inherited
|
||||||
|
protected void sessionDidEnd ()
|
||||||
|
{
|
||||||
|
super.sessionDidEnd();
|
||||||
|
|
||||||
|
// let the peer manager know that we're audi
|
||||||
|
_peermgr.peerEndedSession(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from PresentsSession
|
@Override // from PresentsSession
|
||||||
|
|||||||
Reference in New Issue
Block a user