summaryrefslogtreecommitdiffhomepage
path: root/docs/sources/lib.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/sources/lib.md')
-rw-r--r--docs/sources/lib.md9
1 files changed, 1 insertions, 8 deletions
diff --git a/docs/sources/lib.md b/docs/sources/lib.md
index c76133f9..ba481797 100644
--- a/docs/sources/lib.md
+++ b/docs/sources/lib.md
@@ -39,15 +39,8 @@ func main() {
}
// monitor the change of the peer state
- if pm, err := s.NewPeerMonitor(&api.MonitorPeerRequest{}); err != nil {
+ if err := s.MonitorPeer(context.Background(), &api.MonitorPeerRequest{}, func(p *api.Peer){log.Info(p)}); err != nil {
log.Fatal(err)
- } else {
- defer pm.Close()
- go func() {
- for v := range pm.Inbox {
- log.Info(v)
- }
- }()
}
// neighbor configuration