github.com/TeaOSLab/EdgeNode@v1.3.8/internal/compressions/reader_pool_deflate.go (about)

     1  // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
     2  
     3  package compressions
     4  
     5  import (
     6  	teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
     7  	"io"
     8  )
     9  
    10  var sharedDeflateReaderPool *ReaderPool
    11  
    12  func init() {
    13  	if !teaconst.IsMain {
    14  		return
    15  	}
    16  
    17  	sharedDeflateReaderPool = NewReaderPool(CalculatePoolSize(), func(reader io.Reader) (Reader, error) {
    18  		return newDeflateReader(reader)
    19  	})
    20  }