mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-25 06:26:34 +08:00
优化代码
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/utils"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/utils/bytepool"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -68,11 +69,11 @@ func (this *HTTPRequest) doShutdown() {
|
||||
this.ProcessResponseHeaders(this.writer.Header(), http.StatusOK)
|
||||
this.writer.WriteHeader(http.StatusOK)
|
||||
}
|
||||
var buf = utils.BytePool1k.Get()
|
||||
var buf = bytepool.Pool1k.Get()
|
||||
_, err = utils.CopyWithFilter(this.writer, fp, buf.Bytes, func(p []byte) []byte {
|
||||
return []byte(this.Format(string(p)))
|
||||
})
|
||||
utils.BytePool1k.Put(buf)
|
||||
bytepool.Pool1k.Put(buf)
|
||||
if err != nil {
|
||||
if !this.canIgnore(err) {
|
||||
remotelogs.Warn("HTTP_REQUEST_SHUTDOWN", "write to client failed: "+err.Error())
|
||||
|
||||
Reference in New Issue
Block a user