tcpip/link/channel: docs stale on (*Endpoint).ReadContext
bradfitz opened this issue · comments
Brad Fitzpatrick commented
Description
https://pkg.go.dev/gvisor.dev/gvisor/pkg/tcpip/link/channel#Endpoint.ReadContext has signature:
func (e *Endpoint) ReadContext(ctx context.Context) *stack.PacketBuffer
With godoc:
ReadContext does blocking read for one packet from the outbound packet queue. It can be cancelled by ctx, and in this case, it returns false.
It can't return false, as the bool argument was removed recently.
Looks like it should be returns nil
, based on the code:
// ReadContext does blocking read for one packet from the outbound packet queue.
// It can be cancelled by ctx, and in this case, it returns false.
func (e *Endpoint) ReadContext(ctx context.Context) *stack.PacketBuffer {
return e.q.ReadContext(ctx)
}
func (q *queue) ReadContext(ctx context.Context) *stack.PacketBuffer {
select {
case pkt := <-q.c:
return pkt
case <-ctx.Done():
return nil
}
}