This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 111111 "is-ipfs" : " ^0.3.0" ,
112112 "isstream" : " ^0.1.2" ,
113113 "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" ,
117117 "libp2p-mdns" : " ^0.7.0" ,
118118 "libp2p-multiplex" : " ^0.4.3" ,
119119 "libp2p-railing" : " ^0.5.1" ,
145145 "pull-stream-to-stream" : " ^1.3.4" ,
146146 "pull-zip" : " ^2.0.1" ,
147147 "read-pkg-up" : " ^2.0.0" ,
148- "readable-stream" : " 1.1.14 " ,
148+ "readable-stream" : " 2.3.3 " ,
149149 "safe-buffer" : " ^5.1.1" ,
150150 "stream-to-pull-stream" : " ^1.7.2" ,
151151 "tar-stream" : " ^1.5.4" ,
Original file line number Diff line number Diff line change 22
33module . exports = function isOnline ( self ) {
44 return ( ) => {
5- return Boolean ( self . _bitswap && self . _libp2pNode )
5+ return Boolean ( self . _bitswap && self . _libp2pNode && self . _libp2pNode . isStarted ( ) )
66 }
77}
Original file line number Diff line number Diff line change @@ -26,10 +26,15 @@ module.exports = function libp2p (self) {
2626 self . _libp2pNode = new Node ( self . _peerInfo , self . _peerInfoBook , options )
2727
2828 self . _libp2pNode . on ( 'peer:discovery' , ( peerInfo ) => {
29- if ( self . isOnline ( ) ) {
29+ const dial = ( ) => {
3030 self . _peerInfoBook . put ( peerInfo )
3131 self . _libp2pNode . dial ( peerInfo , ( ) => { } )
3232 }
33+ if ( self . isOnline ( ) ) {
34+ dial ( )
35+ } else {
36+ self . _libp2pNode . once ( 'start' , dial )
37+ }
3338 } )
3439
3540 self . _libp2pNode . on ( 'peer:connect' , ( peerInfo ) => {
You can’t perform that action at this time.
0 commit comments