This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 3 files changed +11
-6
lines changed
3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 111
111
"is-ipfs" : " ^0.3.0" ,
112
112
"isstream" : " ^0.1.2" ,
113
113
"joi" : " ^10.6.0" ,
114
- "libp2p" : " ^0.9.1 " ,
115
- "libp2p-floodsub" : " ~0.9.4 " ,
116
- "libp2p-kad-dht" : " ^0.1 .0" ,
114
+ "libp2p" : " ^0.10.0 " ,
115
+ "libp2p-floodsub" : " ~0.10.0 " ,
116
+ "libp2p-kad-dht" : " ^0.2 .0" ,
117
117
"libp2p-mdns" : " ^0.7.0" ,
118
118
"libp2p-multiplex" : " ^0.4.3" ,
119
119
"libp2p-railing" : " ^0.5.1" ,
145
145
"pull-stream-to-stream" : " ^1.3.4" ,
146
146
"pull-zip" : " ^2.0.1" ,
147
147
"read-pkg-up" : " ^2.0.0" ,
148
- "readable-stream" : " 1.1.14 " ,
148
+ "readable-stream" : " 2.3.3 " ,
149
149
"safe-buffer" : " ^5.1.1" ,
150
150
"stream-to-pull-stream" : " ^1.7.2" ,
151
151
"tar-stream" : " ^1.5.4" ,
Original file line number Diff line number Diff line change 2
2
3
3
module . exports = function isOnline ( self ) {
4
4
return ( ) => {
5
- return Boolean ( self . _bitswap && self . _libp2pNode )
5
+ return Boolean ( self . _bitswap && self . _libp2pNode && self . _libp2pNode . isStarted ( ) )
6
6
}
7
7
}
Original file line number Diff line number Diff line change @@ -26,10 +26,15 @@ module.exports = function libp2p (self) {
26
26
self . _libp2pNode = new Node ( self . _peerInfo , self . _peerInfoBook , options )
27
27
28
28
self . _libp2pNode . on ( 'peer:discovery' , ( peerInfo ) => {
29
- if ( self . isOnline ( ) ) {
29
+ const dial = ( ) => {
30
30
self . _peerInfoBook . put ( peerInfo )
31
31
self . _libp2pNode . dial ( peerInfo , ( ) => { } )
32
32
}
33
+ if ( self . isOnline ( ) ) {
34
+ dial ( )
35
+ } else {
36
+ self . _libp2pNode . once ( 'start' , dial )
37
+ }
33
38
} )
34
39
35
40
self . _libp2pNode . on ( 'peer:connect' , ( peerInfo ) => {
You can’t perform that action at this time.
0 commit comments