Remove read deadlines from the connection.
Prevents the connection from closing from a lack of incoming messages.
This commit is contained in:
13
config.go
13
config.go
@@ -9,7 +9,6 @@ type CloseHandler func(code int, text string) error
|
||||
|
||||
type Config struct {
|
||||
CloseHandler CloseHandler
|
||||
ReadTimeout time.Duration
|
||||
WriteTimeout time.Duration
|
||||
Retry *RetryConfig
|
||||
}
|
||||
@@ -37,7 +36,6 @@ func NewConfig(options ...ConfigOption) (*Config, error) {
|
||||
func GetDefaultConfig() *Config {
|
||||
return &Config{
|
||||
CloseHandler: nil,
|
||||
ReadTimeout: 30 * time.Second,
|
||||
WriteTimeout: 30 * time.Second,
|
||||
Retry: GetDefaultRetryConfig(),
|
||||
}
|
||||
@@ -80,17 +78,6 @@ func WithCloseHandler(handler CloseHandler) ConfigOption {
|
||||
}
|
||||
}
|
||||
|
||||
// When ReadTimeout is set to zero, read timeouts are disabled.
|
||||
func WithReadTimeout(value time.Duration) ConfigOption {
|
||||
return func(c *Config) error {
|
||||
if value < 0 {
|
||||
return errors.InvalidReadTimeout
|
||||
}
|
||||
c.ReadTimeout = value
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// When WriteTimeout is set to zero, read timeouts are disabled.
|
||||
func WithWriteTimeout(value time.Duration) ConfigOption {
|
||||
return func(c *Config) error {
|
||||
|
||||
Reference in New Issue
Block a user