config: add a read limit option to the connection.
By default, the read limit is never set by NewConnection. When using the default pool dialer, a read limit of 512KB is set. When the read limit option is set, all sockets passed to NewConnection have that read limit set.
This commit is contained in:
@@ -45,6 +45,7 @@ type MockSocket struct {
|
||||
CloseFunc func() error
|
||||
SetCloseHandlerFunc func(func(int, string) error)
|
||||
SetPongHandlerFunc func(func(string) error)
|
||||
SetReadLimitFunc func(limit int64)
|
||||
Closed chan struct{}
|
||||
Once sync.Once
|
||||
Mu sync.Mutex
|
||||
@@ -61,6 +62,7 @@ func NewMockSocket() *MockSocket {
|
||||
SetWriteDeadlineFunc: func(time.Time) error { return nil },
|
||||
SetCloseHandlerFunc: func(func(int, string) error) {},
|
||||
SetPongHandlerFunc: func(func(string) error) {},
|
||||
SetReadLimitFunc: func(limit int64) {},
|
||||
|
||||
Closed: make(chan struct{}),
|
||||
}
|
||||
@@ -99,6 +101,10 @@ func (m *MockSocket) SetPongHandler(h func(s string) error) {
|
||||
m.SetPongHandlerFunc(h)
|
||||
}
|
||||
|
||||
func (m *MockSocket) SetReadLimit(limit int64) {
|
||||
m.SetReadLimitFunc(limit)
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Logging mocks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user