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 (
2424 "time"
2525)
2626
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().
2731type BufferConfig struct {
2832 HighWaterMark int // >= 1
2933 FlushInterval time.Duration // 0 to disable time-based flush
@@ -57,8 +61,11 @@ func (c BufferConfig) normalized() BufferConfig {
5761 return cfg
5862}
5963
64+ // Option is a functional option used to configure a Server at construction time.
6065type Option func (* Server )
6166
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.
6269func WithBufferConfig (cfg BufferConfig ) Option {
6370 return func (s * Server ) {
6471 s .bufCfg = cfg .normalized ()
You can’t perform that action at this time.
0 commit comments