Skip to content

Commit b118399

Browse files
committed
Some renames and clarifications
1 parent d0c942d commit b118399

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

internal/msgpackrouter/router.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,26 @@ type Router struct {
3333
routesLock sync.Mutex
3434
routes map[string]*msgpackrpc.Connection
3535
routesInternal map[string]RouterRequestHandler
36-
sendQueueSize int
36+
sendMaxWorkers int
3737
}
3838

39-
func New(perConnSendQueueSize int) *Router {
39+
func New(perConnMaxWorkers int) *Router {
4040
return &Router{
4141
routes: make(map[string]*msgpackrpc.Connection),
4242
routesInternal: make(map[string]RouterRequestHandler),
43-
sendQueueSize: perConnSendQueueSize,
43+
sendMaxWorkers: perConnMaxWorkers,
4444
}
4545
}
4646

47-
// SetSendQueueSize sets the size of the send queue for each connection.
47+
// SetSendMaxWorkers sets the maximum number of workers for sending on each connection,
48+
// this value limits the number of concurrent requests that can be sent on each connection.
49+
// A value of 0 means unlimited workers.
4850
// Only new connections will be affected by this change, existing connections
49-
// will keep their current send queue size.
50-
func (r *Router) SetSendQueueSize(size int) {
51+
// will keep their current sendMaxWorkers value.
52+
func (r *Router) SetSendMaxWorkers(size int) {
5153
r.routesLock.Lock()
5254
defer r.routesLock.Unlock()
53-
r.sendQueueSize = size
55+
r.sendMaxWorkers = size
5456
}
5557

5658
func (r *Router) Accept(conn io.ReadWriteCloser) <-chan struct{} {
@@ -167,7 +169,7 @@ func (r *Router) connectionLoop(conn io.ReadWriteCloser) {
167169
}
168170
slog.Error("Error in connection", "err", err)
169171
},
170-
r.sendQueueSize,
172+
r.sendMaxWorkers,
171173
)
172174

173175
msgpackconn.Run()

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func main() {
8181
cmd.Flags().StringVarP(&cfg.SerialPortAddr, "serial-port", "p", "", "Serial port address")
8282
cmd.Flags().IntVarP(&cfg.SerialBaudRate, "serial-baudrate", "b", 115200, "Serial port baud rate")
8383
cmd.Flags().StringVarP(&cfg.MonitorPortAddr, "monitor-port", "m", "127.0.0.1:7500", "Listening port for MCU monitor proxy")
84-
cmd.Flags().IntVarP(&cfg.MaxPendingRequestsPerClient, "max-pending-requests", "", 25, "Maximum number of pending requests per client connection")
84+
cmd.Flags().IntVarP(&cfg.MaxPendingRequestsPerClient, "max-pending-requests", "", 25, "Maximum number of pending requests per client connection (0 = unlimited)")
8585
cmd.AddCommand(&cobra.Command{
8686
Use: "version",
8787
Long: "Print version information",

0 commit comments

Comments
 (0)