@@ -22,6 +22,7 @@ type connOptions struct {
22
22
AcceptVersions []string
23
23
Header * frame.Header
24
24
ReadChannelCapacity , WriteChannelCapacity int
25
+ ReadBufferSize , WriteBufferSize int
25
26
}
26
27
27
28
func newConnOptions (conn * Conn , opts []func (* Conn ) error ) (* connOptions , error ) {
@@ -156,6 +157,16 @@ var ConnOpt struct {
156
157
// same time. A high number may affect memory usage while a too low number may lock the
157
158
// system up. Default is set to 20.
158
159
WriteChannelCapacity func (capacity int ) func (* Conn ) error
160
+
161
+ // ReadBufferSize specifies number of bytes that can be used to read the message
162
+ // A high number may affect memory usage while a too low number may lock the
163
+ // system up. Default is set to 4096.
164
+ ReadBufferSize func (size int ) func (* Conn ) error
165
+
166
+ // WriteBufferSize specifies number of bytes that can be used to write the message
167
+ // A high number may affect memory usage while a too low number may lock the
168
+ // system up. Default is set to 4096.
169
+ WriteBufferSize func (size int ) func (* Conn ) error
159
170
}
160
171
161
172
func init () {
@@ -244,4 +255,18 @@ func init() {
244
255
return nil
245
256
}
246
257
}
258
+
259
+ ConnOpt .ReadBufferSize = func (size int ) func (* Conn ) error {
260
+ return func (c * Conn ) error {
261
+ c .options .ReadBufferSize = size
262
+ return nil
263
+ }
264
+ }
265
+
266
+ ConnOpt .WriteBufferSize = func (size int ) func (* Conn ) error {
267
+ return func (c * Conn ) error {
268
+ c .options .WriteBufferSize = size
269
+ return nil
270
+ }
271
+ }
247
272
}
0 commit comments