This repository was archived by the owner on Oct 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 30
30
"devDependencies" : {
31
31
"aegir" : " ^21.2.0" ,
32
32
"chai" : " ^4.2.0" ,
33
- "dirty-chai" : " ^2.0.1"
33
+ "dirty-chai" : " ^2.0.1" ,
34
+ "libp2p-interfaces" : " libp2p/js-interfaces#v0.3.x"
34
35
},
35
36
"dependencies" : {
36
37
"debug" : " ^4.1.1" ,
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ class Bootstrap extends EventEmitter {
49
49
* Emit each address in the list as a PeerInfo.
50
50
*/
51
51
_discoverBootstrapPeers ( ) {
52
+ if ( ! this . _timer ) {
53
+ return
54
+ }
55
+
52
56
this . _list . forEach ( ( candidate ) => {
53
57
if ( ! mafmt . P2P . matches ( candidate ) ) {
54
58
return log . error ( 'Invalid multiaddr' )
@@ -73,10 +77,8 @@ class Bootstrap extends EventEmitter {
73
77
* Stop emitting events.
74
78
*/
75
79
stop ( ) {
76
- if ( this . _timer ) {
77
- clearInterval ( this . _timer )
78
- this . _timer = null
79
- }
80
+ clearInterval ( this . _timer )
81
+ this . _timer = null
80
82
}
81
83
}
82
84
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ /* eslint-env mocha */
4
+
5
+ const tests = require ( 'libp2p-interfaces/src/peer-discovery/tests' )
6
+
7
+ const Bootstrap = require ( '../src' )
8
+ const peerList = require ( './default-peers' )
9
+
10
+ describe ( 'compliance tests' , ( ) => {
11
+ tests ( {
12
+ setup ( ) {
13
+ const bootstrap = new Bootstrap ( {
14
+ list : peerList ,
15
+ interval : 2000
16
+ } )
17
+
18
+ return bootstrap
19
+ }
20
+ } )
21
+ } )
You can’t perform that action at this time.
0 commit comments