setWindow method
void
setWindow(
- int newSize
)
Implementation
void setWindow(int newSize) {
_receiveWindow = newSize;
if (_connected && remoteId != null && remoteHost != null && remotePort != null) {
// Use a local variable to avoid multiple null checks
final socket = _socket;
if (socket == null) {
////print('[UDXStream ${this.id}.setWindow] Socket is null, cannot send window update.');
return;
}
if (socket.closing) {
////print('[UDXStream ${this.id}.setWindow] Socket is closing, skipping window update send.');
return;
}
final windowUpdatePacket = UDXPacket(
destinationCid: _socket!.cids.remoteCid,
sourceCid: _socket!.cids.localCid,
destinationStreamId: remoteId!,
sourceStreamId: id,
sequence: packetManager.nextSequence,
frames: [WindowUpdateFrame(windowSize: _receiveWindow)],
);
socket.send(windowUpdatePacket.toBytes());
}
}