in lib/src/flowcontrol/connection_queues.dart [81:111]
void _trySendMessages() {
if (!wasTerminated) {
// We can make progress if
// * there is at least one message to send
// * the underlying frame writer / sink / socket doesn't block
// * either one
// * the next message is a non-flow control message (e.g. headers)
// * the connection window is positive
if (_messages.isNotEmpty &&
!_frameWriter.bufferIndicator.wouldBuffer &&
(!_connectionWindow.positiveWindow.wouldBuffer ||
_messages.first is! DataMessage)) {
_trySendMessage();
// If we have more messages and we can send them, we'll run them
// using `Timer.run()` to let other things get in-between.
if (_messages.isNotEmpty &&
!_frameWriter.bufferIndicator.wouldBuffer &&
(!_connectionWindow.positiveWindow.wouldBuffer ||
_messages.first is! DataMessage)) {
// TODO: If all the frame writer methods would return the
// number of bytes written, we could just say, we loop here until 10kb
// and after words, we'll make `Timer.run()`.
Timer.run(_trySendMessages);
} else {
onCheckForClose();
}
}
}
}