Just a notice for future readers. As today (2017.07.25) it's enough to
listen on context.Done().
func (p *XImpl) Listen(_ *empty.Empty, rec services.X_ListenServer) error {
c := make(chan *services.X, 16)
p.add(c)
defer p.remove(c)
ctx := rec.Context()
for {
select {
case v := <-c:
if err := rec.Send(v); err != nil {
return err
}
case <-ctx.Done():
return nil
}
}
}
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/5073d61e-2031-48d0-b02f-10d06cd4f5e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.