Add auto Flush to core WriteBuffer
This commit is contained in:
@@ -3,6 +3,7 @@ package core
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -32,6 +33,8 @@ func (w *WriteBuffer) Write(p []byte) (n int, err error) {
|
|||||||
} else if n, err = w.Writer.Write(p); err != nil {
|
} else if n, err = w.Writer.Write(p); err != nil {
|
||||||
w.err = err
|
w.err = err
|
||||||
w.done()
|
w.done()
|
||||||
|
} else if f, ok := w.Writer.(http.Flusher); ok {
|
||||||
|
f.Flush()
|
||||||
}
|
}
|
||||||
w.mu.Unlock()
|
w.mu.Unlock()
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user