* Tunnels: Use consistent tunnel pair for Delivery Status Message

to reduce network connections (ticket #1350)
This commit is contained in:
zzz
2014-08-18 18:57:19 +00:00
parent 51995cc428
commit 66bbe21a87
4 changed files with 12 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 5;
public final static long BUILD = 6;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -729,7 +729,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
*
*/
private TunnelInfo selectInboundTunnel() {
return getContext().tunnelManager().selectInboundTunnel(_from.calculateHash());
// Use tunnel EP closest to his hash, as a simple cache to minimize connections
return getContext().tunnelManager().selectInboundTunnel(_from.calculateHash(), _to.calculateHash());
}
/**

View File

@@ -160,7 +160,8 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
} else {
// ok, they want us to send it remotely, but that'd bust our anonymity,
// so we send it out a tunnel first
TunnelInfo out = _context.tunnelManager().selectOutboundTunnel(_client);
// TODO use the OCMOSJ cache to pick OB tunnel we are already using?
TunnelInfo out = _context.tunnelManager().selectOutboundTunnel(_client, target);
if (out == null) {
if (_log.shouldLog(Log.WARN))
_log.warn("no outbound tunnel to send the client message for " + _client + ": " + msg);