ing
This commit is contained in:
parent
d1d485c711
commit
20a63b3de6
|
@ -16,6 +16,7 @@ type ReadWriteHandler interface {
|
|||
|
||||
IsEnableCompression() bool
|
||||
GetCompressionLevel() int
|
||||
GetCompressionThreshold() int
|
||||
}
|
||||
|
||||
type ReadWriteHandlers struct {
|
||||
|
@ -25,8 +26,9 @@ type ReadWriteHandlers struct {
|
|||
PingTimeout time.Duration `json:"pingTimeout,omitempty"`
|
||||
PingPeriod time.Duration `json:"pingPeriod,omitempty"`
|
||||
|
||||
EnableCompression bool `json:"enableCompression,omitempty"`
|
||||
CompressionLevel int `json:"compressionLevel,omitempty"`
|
||||
EnableCompression bool `json:"enableCompression,omitempty"`
|
||||
CompressionLevel int `json:"compressionLevel,omitempty"`
|
||||
CompressionThreshold int `json:"compressionThreshold,omitempty"`
|
||||
|
||||
validated atomic.Value
|
||||
}
|
||||
|
@ -47,16 +49,20 @@ func (rwh *ReadWriteHandlers) IsEnableCompression() bool {
|
|||
func (rwh *ReadWriteHandlers) GetCompressionLevel() int {
|
||||
return rwh.CompressionLevel
|
||||
}
|
||||
func (rwh *ReadWriteHandlers) GetCompressionThreshold() int {
|
||||
return rwh.CompressionThreshold
|
||||
}
|
||||
|
||||
func (rwh *ReadWriteHandlers) Clone() *ReadWriteHandlers {
|
||||
return &ReadWriteHandlers{
|
||||
ReadWriteHandlers: *rwh.ReadWriteHandlers.Clone(),
|
||||
PongTimeout: rwh.PongTimeout,
|
||||
PingTimeout: rwh.PingTimeout,
|
||||
PingPeriod: rwh.PingPeriod,
|
||||
EnableCompression: rwh.EnableCompression,
|
||||
CompressionLevel: rwh.CompressionLevel,
|
||||
validated: rwh.validated,
|
||||
ReadWriteHandlers: *rwh.ReadWriteHandlers.Clone(),
|
||||
PongTimeout: rwh.PongTimeout,
|
||||
PingTimeout: rwh.PingTimeout,
|
||||
PingPeriod: rwh.PingPeriod,
|
||||
EnableCompression: rwh.EnableCompression,
|
||||
CompressionLevel: rwh.CompressionLevel,
|
||||
CompressionThreshold: rwh.CompressionThreshold,
|
||||
validated: rwh.validated,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,5 +99,9 @@ func (rwh *ReadWriteHandlers) Validate() error {
|
|||
}
|
||||
}
|
||||
|
||||
if 0 > rwh.CompressionThreshold {
|
||||
rwh.CompressionThreshold = server.DefaultCompressionThreshold
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user