From d49b6fedf59e9e66aa1e3e035649a72de952b3cf Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Tue, 13 Jan 2015 08:14:35 -0800 Subject: [PATCH] p2p/net/swarm: sync diagram explain --- net/swarm/swarm_dial.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/swarm/swarm_dial.go b/net/swarm/swarm_dial.go index a1286efe..4528c2c4 100644 --- a/net/swarm/swarm_dial.go +++ b/net/swarm/swarm_dial.go @@ -17,6 +17,17 @@ import ( manet "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net" ) +// Diagram of dial sync: +// +// many callers of Dial() synched w. dials many addrs results to callers +// ----------------------\ dialsync use earliest /-------------- +// -----------------------\ |----------\ /---------------- +// ------------------------>------------<------- >---------<----------------- +// -----------------------| \----x \---------------- +// ----------------------| \-----x \--------------- +// any may fail if no addr at end +// retry dialAttempt x + // dialAttempts governs how many times a goroutine will try to dial a given peer. const dialAttempts = 3