Commit f73c045 1 parent 8840c9b commit f73c045 Copy full SHA for f73c045
File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,12 @@ class Node extends EventEmitter {
41
41
// Received incommind dial and muxer upgrade happened, reuse this
42
42
// muxed connection
43
43
this . swarm . on ( 'peer-mux-established' , ( peerInfo ) => {
44
+ this . emit ( 'peer:connect' , peerInfo )
44
45
this . peerBook . put ( peerInfo )
45
46
} )
46
47
47
48
this . swarm . on ( 'peer-mux-closed' , ( peerInfo ) => {
49
+ this . emit ( 'peer:disconnect' , peerInfo )
48
50
this . peerBook . removeByB58String ( peerInfo . id . toB58String ( ) )
49
51
} )
50
52
}
@@ -62,8 +64,9 @@ class Node extends EventEmitter {
62
64
if ( this . modules . discovery ) {
63
65
let discoveries = this . modules . discovery
64
66
discoveries = Array . isArray ( discoveries ) ? discoveries : [ discoveries ]
67
+
65
68
discoveries . forEach ( ( discovery ) => {
66
- discovery . on ( 'peer' , ( peerInfo ) => this . emit ( 'peer' , peerInfo ) )
69
+ discovery . on ( 'peer' , ( peerInfo ) => this . emit ( 'peer:discovery ' , peerInfo ) )
67
70
} )
68
71
}
69
72
You can’t perform that action at this time.
0 commit comments