google / gvisor

Application Kernel for Containers
https://gvisor.dev
Apache License 2.0
15.38k stars 1.27k forks source link

tcpip.Endpoint.Write() doc is out of date #6024

Open bemasc opened 3 years ago

bemasc commented 3 years ago

The doc says

    // Unlike io.Writer.Write, Endpoint.Write transfers ownership of any bytes
    // successfully written to the Endpoint. That is, if a call to
    // Write(SlicePayload{data}) returns (n, err), it may retain data[:n], and
    // the caller should not use data[:n] after Write returns.

but the signature of Write has since changed. It no longer accepts a slice payload, so this advice is no longer applicable.

ianlewis commented 3 years ago

For posterity the comment in question is here: https://github.com/google/gvisor/blob/b8b43f70c898861a6fd642ded069dd33d35f17f9/pkg/tcpip/tcpip.go#L506-L509

himanshu007-creator commented 3 years ago

hi i would like to work on this issue. But i wanted to ask, Do we have to update L508 or simply remove it? if update then with what. thanks

himanshu007-creator commented 3 years ago

@ianlewis 👀

milantracy commented 2 years ago

imo you have to update the comment.

From the implementations[0][1] of the interface, the behavior is still valid

[0] https://github.com/google/gvisor/blob/master/pkg/tcpip/transport/tcp/endpoint.go#L1563 [1] https://github.com/google/gvisor/blob/master/pkg/tcpip/transport/udp/endpoint.go#L430

namit-chandwani commented 2 years ago

Hey @ianlewis, I'd like to work on this issue. Can you please assign it to me?

github-actions[bot] commented 10 months ago

A friendly reminder that this issue had no activity for 120 days.