Skip to content

Commit

Permalink
all: make function and struct comments match the names
Browse files Browse the repository at this point in the history
Change-Id: I1f4a4c8daec5ac7d26f1d4df76726af664adcb36
Reviewed-on: https://go-review.googlesource.com/c/net/+/639576
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Damien Neil <dneil@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
  • Loading branch information
cuishuang authored and gopherbot committed Jan 2, 2025
1 parent e9d95ba commit 2124140
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion http2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func configFromServer(h1 *http.Server, h2 *Server) http2Config {
return conf
}

// configFromServer merges configuration settings from h2 and h2.t1.HTTP2
// configFromTransport merges configuration settings from h2 and h2.t1.HTTP2
// (the net/http Transport).
func configFromTransport(h2 *Transport) http2Config {
conf := http2Config{
Expand Down
2 changes: 1 addition & 1 deletion http2/config_go124.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func fillNetHTTPServerConfig(conf *http2Config, srv *http.Server) {
fillNetHTTPConfig(conf, srv.HTTP2)
}

// fillNetHTTPServerConfig sets fields in conf from tr.HTTP2.
// fillNetHTTPTransportConfig sets fields in conf from tr.HTTP2.
func fillNetHTTPTransportConfig(conf *http2Config, tr *http.Transport) {
fillNetHTTPConfig(conf, tr.HTTP2)
}
Expand Down
4 changes: 2 additions & 2 deletions http2/gate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func newGate() gate {
return g
}

// newLocked gate returns a new, locked gate.
// newLockedGate returns a new, locked gate.
func newLockedGate() gate {
return gate{
set: make(chan struct{}, 1),
Expand Down Expand Up @@ -78,7 +78,7 @@ func (g *gate) unlock(set bool) {
}
}

// unlock sets the condition to the result of f and releases the gate.
// unlockFunc sets the condition to the result of f and releases the gate.
// Useful in defers.
func (g *gate) unlockFunc(f func() bool) {
g.unlock(f())
Expand Down
2 changes: 1 addition & 1 deletion http2/netconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *synctestNetConn) Write(b []byte) (n int, err error) {
return c.rem.write(b)
}

// IsClosed reports whether the peer has closed its end of the connection.
// IsClosedByPeer reports whether the peer has closed its end of the connection.
func (c *synctestNetConn) IsClosedByPeer() bool {
if c.autoWait {
c.group.Wait()
Expand Down
2 changes: 1 addition & 1 deletion http2/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4327,7 +4327,7 @@ func TestCanonicalHeaderCacheGrowth(t *testing.T) {
}
}

// TestServerWriteDoesNotRetainBufferAfterStreamClose checks for access to
// TestServerWriteDoesNotRetainBufferAfterReturn checks for access to
// the slice passed to ResponseWriter.Write after Write returns.
//
// Terminating the request stream on the client causes Write to return.
Expand Down
2 changes: 1 addition & 1 deletion quic/conn_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (c *Conn) sendOK(now time.Time) bool {
}
}

// sendConnectionClose reports that the conn has sent a CONNECTION_CLOSE to the peer.
// sentConnectionClose reports that the conn has sent a CONNECTION_CLOSE to the peer.
func (c *Conn) sentConnectionClose(now time.Time) {
switch c.lifetime.state {
case connStatePeerClosed:
Expand Down
2 changes: 1 addition & 1 deletion quic/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func (tc *testConn) write(d *testDatagram) {
tc.endpoint.writeDatagram(d)
}

// writeFrame sends the Conn a datagram containing the given frames.
// writeFrames sends the Conn a datagram containing the given frames.
func (tc *testConn) writeFrames(ptype packetType, frames ...debugFrame) {
tc.t.Helper()
space := spaceForPacketType(ptype)
Expand Down
2 changes: 1 addition & 1 deletion quic/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func (m *connsMap) updateConnIDs(f func(*connsMap)) {
m.updateNeeded.Store(true)
}

// applyConnIDUpdates is called by the datagram receive loop to update its connection ID map.
// applyUpdates is called by the datagram receive loop to update its connection ID map.
func (m *connsMap) applyUpdates() {
m.updateMu.Lock()
defer m.updateMu.Unlock()
Expand Down
4 changes: 2 additions & 2 deletions quic/gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func newGate() gate {
return g
}

// newLocked gate returns a new, locked gate.
// newLockedGate returns a new, locked gate.
func newLockedGate() gate {
return gate{
set: make(chan struct{}, 1),
Expand Down Expand Up @@ -84,7 +84,7 @@ func (g *gate) unlock(set bool) {
}
}

// unlock sets the condition to the result of f and releases the gate.
// unlockFunc sets the condition to the result of f and releases the gate.
// Useful in defers.
func (g *gate) unlockFunc(f func() bool) {
g.unlock(f())
Expand Down
2 changes: 1 addition & 1 deletion quic/packet_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func hashForSuite(suite uint16) (h crypto.Hash, keySize int) {
}
}

// hdkfExpandLabel implements HKDF-Expand-Label from RFC 8446, Section 7.1.
// hkdfExpandLabel implements HKDF-Expand-Label from RFC 8446, Section 7.1.
//
// Copied from crypto/tls/key_schedule.go.
func hkdfExpandLabel(hash func() hash.Hash, secret []byte, label string, context []byte, length int) []byte {
Expand Down
4 changes: 2 additions & 2 deletions quic/packet_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (w *packetWriter) datagram() []byte {
return w.b
}

// packet returns the size of the current packet.
// packetLen returns the size of the current packet.
func (w *packetWriter) packetLen() int {
return len(w.b[w.pktOff:]) + aeadOverhead
}
Expand Down Expand Up @@ -527,7 +527,7 @@ func (w *packetWriter) appendConnectionCloseTransportFrame(code transportError,
return true
}

// appendConnectionCloseTransportFrame appends a CONNECTION_CLOSE frame
// appendConnectionCloseApplicationFrame appends a CONNECTION_CLOSE frame
// carrying an application protocol error code.
func (w *packetWriter) appendConnectionCloseApplicationFrame(code uint64, reason string) (added bool) {
if w.avail() < 1+sizeVarint(code)+sizeVarint(uint64(len(reason)))+len(reason) {
Expand Down
4 changes: 2 additions & 2 deletions quic/qlog/json_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (w *jsonWriter) writeAttr(a slog.Attr) {
w.writeValue(a.Value)
}

// writeAttr writes a []slog.Attr as an object field.
// writeAttrsField writes a []slog.Attr as an object field.
func (w *jsonWriter) writeAttrsField(name string, attrs []slog.Attr) {
w.writeName(name)
w.writeAttrs(attrs)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (w *jsonWriter) writeObject(f func()) {
w.buf.WriteByte('}')
}

// writeObject writes an object-valued object field.
// writeObjectField writes an object-valued object field.
// The function f is called to write the contents.
func (w *jsonWriter) writeObjectField(name string, f func()) {
w.writeName(name)
Expand Down
2 changes: 1 addition & 1 deletion quic/rtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (r *rttState) establishPersistentCongestion() {
r.minRTT = r.latestRTT
}

// updateRTTSample is called when we generate a new RTT sample.
// updateSample is called when we generate a new RTT sample.
// https://www.rfc-editor.org/rfc/rfc9002.html#section-5
func (r *rttState) updateSample(now time.Time, handshakeConfirmed bool, spaceID numberSpace, latestRTT, ackDelay, maxAckDelay time.Duration) {
r.latestRTT = latestRTT
Expand Down
2 changes: 1 addition & 1 deletion quic/sent_val.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (s sentVal) isSet() bool { return s != 0 }
// shouldSend reports whether the value is set and has not been sent to the peer.
func (s sentVal) shouldSend() bool { return s.state() == sentValUnsent }

// shouldSend reports whether the value needs to be sent to the peer.
// shouldSendPTO reports whether the value needs to be sent to the peer.
// The value needs to be sent if it is set and has not been sent.
// If pto is true, indicating that we are sending a PTO probe, the value
// should also be sent if it is set and has not been acknowledged.
Expand Down
2 changes: 1 addition & 1 deletion quic/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (s *Stream) Write(b []byte) (n int, err error) {
return n, nil
}

// WriteBytes writes a single byte to the stream.
// WriteByte writes a single byte to the stream.
func (s *Stream) WriteByte(c byte) error {
if s.outbufoff < len(s.outbuf) {
s.outbuf[s.outbufoff] = c
Expand Down
2 changes: 1 addition & 1 deletion quic/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func consumeVarint(b []byte) (v uint64, n int) {
return 0, -1
}

// consumeVarint64 parses a variable-length integer as an int64.
// consumeVarintInt64 parses a variable-length integer as an int64.
func consumeVarintInt64(b []byte) (v int64, n int) {
u, n := consumeVarint(b)
// QUIC varints are 62-bits large, so this conversion can never overflow.
Expand Down
2 changes: 1 addition & 1 deletion route/sys_netbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (m *RouteMessage) Sys() []Sys {
}
}

// RouteMetrics represents route metrics.
// InterfaceMetrics represents route metrics.
type InterfaceMetrics struct {
Type int // interface type
MTU int // maximum transmission unit
Expand Down

0 comments on commit 2124140

Please sign in to comment.