2024-05-17 18:30:33 +08:00
|
|
|
// Copyright 2022 GoEdge goedge.cdn@gmail.com. All rights reserved.
|
2022-03-20 00:05:47 +08:00
|
|
|
|
|
|
|
|
package compressions
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"io"
|
2024-07-27 15:42:50 +08:00
|
|
|
|
|
|
|
|
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
|
2022-03-20 00:05:47 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var sharedDeflateWriterPool *WriterPool
|
|
|
|
|
|
|
|
|
|
func init() {
|
2023-03-10 15:14:14 +08:00
|
|
|
if !teaconst.IsMain {
|
2022-07-26 09:41:43 +08:00
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-17 08:36:14 +08:00
|
|
|
sharedDeflateWriterPool = NewWriterPool(CalculatePoolSize(), func(writer io.Writer, level int) (Writer, error) {
|
2024-04-16 11:32:38 +08:00
|
|
|
return newDeflateWriter(writer)
|
2022-03-20 00:05:47 +08:00
|
|
|
})
|
|
|
|
|
}
|