diff --git a/common/io/reader.go b/common/io/reader.go index cd6524118..8a2abf032 100644 --- a/common/io/reader.go +++ b/common/io/reader.go @@ -33,6 +33,7 @@ type AdaptiveReader struct { } // NewAdaptiveReader creates a new AdaptiveReader. +// The AdaptiveReader instance doesn't take the ownership of reader. func NewAdaptiveReader(reader io.Reader) *AdaptiveReader { return &AdaptiveReader{ reader: reader, diff --git a/common/io/writer.go b/common/io/writer.go index 8901bd52d..2df487ce8 100644 --- a/common/io/writer.go +++ b/common/io/writer.go @@ -26,7 +26,7 @@ func NewAdaptiveWriter(writer io.Writer) *AdaptiveWriter { } } -// Write implements Writer.Write(). +// Write implements Writer.Write(). Write() takes ownership of the given buffer. func (this *AdaptiveWriter) Write(buffer *alloc.Buffer) error { nBytes, err := this.writer.Write(buffer.Value) if nBytes < buffer.Len() { diff --git a/common/protocol/raw/server.go b/common/protocol/raw/server.go index 57cfb25d7..206d9b42c 100644 --- a/common/protocol/raw/server.go +++ b/common/protocol/raw/server.go @@ -24,12 +24,15 @@ type ServerSession struct { responseWriter io.Writer } +// NewServerSession creates a new ServerSession, using the given UserValidator. +// The ServerSession instance doesn't take ownership of the validator. func NewServerSession(validator protocol.UserValidator) *ServerSession { return &ServerSession{ userValidator: validator, } } +// Release implements common.Releaseable. func (this *ServerSession) Release() { this.userValidator = nil this.requestBodyIV = nil