Skip to content

Commit

Permalink
examples: remove unused 'SetStreamHandler' (#2598)
Browse files Browse the repository at this point in the history
  • Loading branch information
joohhnnn committed Nov 11, 2023
1 parent 2f274fc commit 1d84b7d
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions examples/echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,6 @@ func runSender(ctx context.Context, ha host.Host, targetPeer string) {
fullAddr := getHostAddress(ha)
log.Printf("I am %s\n", fullAddr)

// Set a stream handler on host A. /echo/1.0.0 is
// a user-defined protocol name.
ha.SetStreamHandler("/echo/1.0.0", func(s network.Stream) {
log.Println("sender received new stream")
if err := doEcho(s); err != nil {
log.Println(err)
s.Reset()
} else {
s.Close()
}
})

// Turn the targetPeer into a multiaddr.
maddr, err := ma.NewMultiaddr(targetPeer)
if err != nil {
Expand Down

0 comments on commit 1d84b7d

Please sign in to comment.