Skip to content

Commit

Permalink
fix rpc client examle (zeromicro#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
knight0zh authored Sep 18, 2020
1 parent 0b1ee79 commit 0f81400
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion example/rpc/client/stream/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ func main() {
log.Fatal(err)
}

done := make(chan struct{})
go func() {
for {
defer func() {
done <- struct{}{}
}()
for i := 0; i < 3; i++ {
resp, err := stm.Recv()
if err != nil {
log.Fatal(err)
Expand All @@ -52,4 +56,6 @@ func main() {
log.Fatal(err)
}
}

<-done
}

0 comments on commit 0f81400

Please sign in to comment.