hls: speed up serving of files

This commit is contained in:
aler9 2021-09-05 15:43:48 +02:00
parent 7ba507f205
commit 5eb4741278
1 changed files with 1 additions and 15 deletions

View File

@ -187,22 +187,8 @@ func (s *hlsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
select {
case s.request <- hreq:
res := <-cres
if res != nil {
buf := make([]byte, 4096)
for {
n, err := res.Read(buf)
if err != nil {
return
}
_, err = w.Write(buf[:n])
if err != nil {
return
}
w.(http.Flusher).Flush()
}
io.Copy(w, res)
}
case <-s.ctx.Done():