|
@@ -184,14 +184,14 @@ func (stream *Stream) Flush() error {
|
|
|
func (stream *Stream) ensure(minimal int) {
|
|
func (stream *Stream) ensure(minimal int) {
|
|
|
available := stream.Available()
|
|
available := stream.Available()
|
|
|
if available < minimal {
|
|
if available < minimal {
|
|
|
- if stream.n > 1024 {
|
|
|
|
|
- stream.Flush()
|
|
|
|
|
- }
|
|
|
|
|
stream.growAtLeast(minimal)
|
|
stream.growAtLeast(minimal)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (stream *Stream) growAtLeast(minimal int) {
|
|
func (stream *Stream) growAtLeast(minimal int) {
|
|
|
|
|
+ if stream.out != nil {
|
|
|
|
|
+ stream.Flush()
|
|
|
|
|
+ }
|
|
|
toGrow := len(stream.buf)
|
|
toGrow := len(stream.buf)
|
|
|
if toGrow < minimal {
|
|
if toGrow < minimal {
|
|
|
toGrow = minimal
|
|
toGrow = minimal
|