You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: not dial all known peers in parallel on startup (#698)
* fix: not dial all known peers on startup
* feat: connection manager should proactively connect to peers from peerStore
* chore: increase bundle size
* fix: do connMgr proactive dial on an interval
* chore: address review
* chore: use retimer reschedule
* chore: address review
* fix: use minConnections in default config
* chore: minPeers to minConnections everywhere
@@ -45,6 +49,8 @@ class ConnectionManager extends EventEmitter {
45
49
* @param {Number} options.pollInterval How often, in milliseconds, metrics and latency should be checked. Default=2000
46
50
* @param {Number} options.movingAverageInterval How often, in milliseconds, to compute averages. Default=60000
47
51
* @param {Number} options.defaultPeerValue The value of the peer. Default=1
52
+
* @param {boolean} options.autoDial Should preemptively guarantee connections are above the low watermark. Default=true
53
+
* @param {Number} options.autoDialInterval How often, in milliseconds, it should preemptively guarantee connections are above the low watermark. Default=10000
48
54
*/
49
55
constructor(libp2p,options){
50
56
super()
@@ -57,7 +63,7 @@ class ConnectionManager extends EventEmitter {
57
63
throwerrcode(newError('Connection Manager maxConnections must be greater than minConnections'),ERR_INVALID_PARAMETERS)
58
64
}
59
65
60
-
debug('options: %j',this._options)
66
+
log('options: %j',this._options)
61
67
62
68
this._libp2p=libp2p
63
69
@@ -73,8 +79,11 @@ class ConnectionManager extends EventEmitter {
73
79
*/
74
80
this.connections=newMap()
75
81
82
+
this._started=false
76
83
this._timer=null
84
+
this._autoDialTimeout=null
77
85
this._checkMetrics=this._checkMetrics.bind(this)
86
+
this._autoDial=this._autoDial.bind(this)
78
87
}
79
88
80
89
/**
@@ -101,19 +110,25 @@ class ConnectionManager extends EventEmitter {
0 commit comments