File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ import (
24
24
"time"
25
25
)
26
26
27
+ // BufferConfig controls how bytes coming from the board (port) are aggregated
28
+ // into larger chunks before being written to the TCP client. All fields are
29
+ // optional; invalid or zero values are normalized to sensible defaults via
30
+ // normalized().
27
31
type BufferConfig struct {
28
32
HighWaterMark int // >= 1
29
33
FlushInterval time.Duration // 0 to disable time-based flush
@@ -57,8 +61,11 @@ func (c BufferConfig) normalized() BufferConfig {
57
61
return cfg
58
62
}
59
63
64
+ // Option is a functional option used to configure a Server at construction time.
60
65
type Option func (* Server )
61
66
67
+ // WithBufferConfig sets the Server's buffering behavior. The provided cfg is
68
+ // normalized (e.g., min values enforced) before being stored on the Server.
62
69
func WithBufferConfig (cfg BufferConfig ) Option {
63
70
return func (s * Server ) {
64
71
s .bufCfg = cfg .normalized ()
You can’t perform that action at this time.
0 commit comments