缓存文件实现Sendfile

This commit is contained in:
刘祥超
2022-04-04 19:45:57 +08:00
parent a59007a249
commit 221d7e6434
7 changed files with 41 additions and 2 deletions

View File

@@ -13,6 +13,10 @@ func NewBytesCounterWriter(rawWriter io.Writer) *BytesCounterWriter {
return &BytesCounterWriter{writer: rawWriter}
}
func (this *BytesCounterWriter) RawWriter() io.Writer {
return this.writer
}
func (this *BytesCounterWriter) Write(p []byte) (n int, err error) {
n, err = this.writer.Write(p)
this.count += int64(n)