Added explicit Flush method to utils.WriteFlusher

This commit is contained in:
Dan Hirsch
2013-11-01 13:11:21 -04:00
parent dd9f4524d1
commit a963ff5d8d
2 changed files with 12 additions and 5 deletions
+7
View File
@@ -616,6 +616,13 @@ func (wf *WriteFlusher) Write(b []byte) (n int, err error) {
return n, err
}
// Flush the stream immediately.
func (wf *WriteFlusher) Flush() {
wf.Lock()
defer wf.Unlock()
wf.flusher.Flush()
}
func NewWriteFlusher(w io.Writer) *WriteFlusher {
var flusher http.Flusher
if f, ok := w.(http.Flusher); ok {