Skip to content

Commit a26ad00

Browse files
Merge pull request #120 from libp2p/feat/801
Introduce EvtPeerConnectednessChanged event
2 parents 878b651 + defb415 commit a26ad00

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core/event/network.go

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package event
2+
3+
import (
4+
"github.com/libp2p/go-libp2p-core/network"
5+
"github.com/libp2p/go-libp2p-core/peer"
6+
)
7+
8+
// EvtPeerConnectednessChanged should be emitted every time we form a connection with a peer or drop our last
9+
// connection with the peer. Essentially, it is emitted in two cases:
10+
// a) We form a/any connection with a peer.
11+
// b) We go from having a connection/s with a peer to having no connection with the peer.
12+
// It contains the Id of the remote peer and the new connectedness state.
13+
type EvtPeerConnectednessChanged struct {
14+
Peer peer.ID
15+
Connectedness network.Connectedness
16+
}

0 commit comments

Comments
 (0)