fix(server): keep script chunks within legacy client read limits
This commit is contained in:
1 parent
1b5c6dbf98
commit
474afb3484
5 files changed
+107
-1
No files matched your search
@@ -513,7 +513,10 @@ func (server *AgentServer) enqueueNextDispatch(ctx context.Context, queue *Write
|
||||
return candidate.IssueUUID, true, nil
|
||||
}
|
||||
|
||||
const scriptSendWindowBytes uint64 = 1 << 20
|
||||
const (
|
||||
scriptSendWindowBytes uint64 = 1 << 20
|
||||
scriptChunkTargetBytes uint64 = 16 << 10
|
||||
)
|
||||
|
||||
type scriptTransfer struct {
|
||||
Body []byte
|
||||
@@ -531,6 +534,12 @@ func (server *AgentServer) enqueueNextScript(queue *WriterQueue, sessionID strin
|
||||
if chunkLimit == 0 {
|
||||
return false, errors.New("script chunk limit is zero")
|
||||
}
|
||||
// The protocol ceiling is an upper bound, not a required chunk size.
|
||||
// Leave room for envelope metadata below the historical 32 KiB client
|
||||
// reader so an installed older client can receive its pending script.
|
||||
if chunkLimit > scriptChunkTargetBytes {
|
||||
chunkLimit = scriptChunkTargetBytes
|
||||
}
|
||||
sentMu.Lock()
|
||||
keys := make([]string, 0, len(transfers))
|
||||
for key := range transfers {
|
||||
|
||||
Reference in new issue
Block a user