This repository was archived by the owner on Feb 26, 2021. It is now read-only.
File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,13 @@ function getServerForAddress (addr) {
25
25
* @param {PeerId } options.id - Id for the crypto challenge
26
26
* @param {Transport[] } options.transports - Transport(s) for microswitch
27
27
* @param {Muxer[] } options.muxers - Muxer(s) for microswitch
28
+ * @param {boolean } options.softFail - Whether to softly fail on listen errors
28
29
*/
29
30
class Stardust {
30
- constructor ( { transports, muxers, id } ) {
31
+ constructor ( { transports, muxers, id, softFail } ) {
31
32
this . switch = new MicroSwitch ( { transports, addresses : [ ] , muxers } )
32
33
this . id = id
34
+ this . softFail = softFail
33
35
34
36
this . discovery = new EE ( )
35
37
this . discovery . tag = 'stardust'
Original file line number Diff line number Diff line change @@ -40,8 +40,14 @@ class Listener extends EventEmitter {
40
40
this . emit ( 'listening' )
41
41
callback ( )
42
42
} , err => {
43
- this . emit ( 'error' , err )
44
- callback ( err )
43
+ if ( this . client . softFail ) {
44
+ this . emit ( 'listening' )
45
+ callback ( )
46
+ // dials will fail, but that's just about it
47
+ } else {
48
+ this . emit ( 'error' , err )
49
+ callback ( err )
50
+ }
45
51
} )
46
52
}
47
53
You can’t perform that action at this time.
0 commit comments