Skip to content

Commit 8ed1a6d

Browse files
committed
fix: allow scenario when all ws-stars are offline
ws-star is optional, should not break boot process
1 parent 38a55a3 commit 8ed1a6d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

add-on/src/lib/ipfs-client/embedded-chromesockets/config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const chromeSocketsOpts = {
2323
*/
2424
Swarm: [
2525
// TODO: listening on TCP (override IP and port at runtime in buildConfig()?)
26-
'/ip4/0.0.0.0/tcp/0'
27-
// TODO: disabled -star signaling: it makes a backup non-LAN peer discovery, but break the boot if server is down
28-
// '/dns4/ws-star1.par.dwebops.pub.com/tcp/443/wss/p2p-websocket-star'
26+
'/ip4/0.0.0.0/tcp/0',
27+
// optional ws-star signaling provides a backup non-LAN peer discovery
28+
'/dns4/ws-star1.par.dwebops.pub.com/tcp/443/wss/p2p-websocket-star'
2929
],
3030
// Delegated Content and Peer Routing: https://github.com/ipfs/js-ipfs/pull/2195
3131
Delegates: // [] // TODO: enable delegates

add-on/src/lib/ipfs-client/embedded-chromesockets/libp2p.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ const multiaddr = require('multiaddr')
1818
class Libp2pChromeSockets extends libp2p {
1919
constructor (_options) {
2020
// this can be replaced once optional listening is supported with the below code. ref: https://github.com/libp2p/interface-transport/issues/41
21-
// const wsstar = new WebSocketStar({ id: _options.peerInfo.id })
21+
// const wsstar = new WebSocketStar({ id: _options.peerInfo.id, ignore_no_online: true })
2222
const wsstarServers = _options.peerInfo.multiaddrs.toArray().map(String).filter(addr => addr.includes('p2p-websocket-star'))
2323
_options.peerInfo.multiaddrs.replace(wsstarServers.map(multiaddr), '/p2p-websocket-star') // the ws-star-multi module will replace this with the chosen ws-star servers
24-
const wsstar = new WebSocketStarMulti({ servers: wsstarServers, id: _options.peerInfo.id, ignore_no_online: !wsstarServers.length || _options.wsStarIgnoreErrors })
24+
const wsstar = new WebSocketStarMulti({
25+
servers: wsstarServers,
26+
id: _options.peerInfo.id,
27+
ignore_no_online: true // allow scenario when all ws-stars are offline
28+
})
2529

2630
const defaults = {
2731
switch: {

0 commit comments

Comments
 (0)