Fix video playback hanging at end (#2996)

Co-authored-by: gerit1a <10052885+gerit1a@users.noreply.github.com>
This commit is contained in:
WithoutPants
2022-10-11 14:24:09 +11:00
committed by GitHub
parent 6b5d5cc628
commit a6fd577f03
2 changed files with 19 additions and 2 deletions

View File

@@ -34,8 +34,21 @@ func (c *StreamRequestContext) Cancel() {
}
// hijack and close the connection
conn, _, _ := hj.Hijack()
conn, bw, _ := hj.Hijack()
if conn != nil {
if bw != nil {
// notify end of stream
_, err := bw.WriteString("0\r\n")
if err != nil {
logger.Warnf("unable to write end of stream: %v", err)
}
_, err = bw.WriteString("\r\n")
if err != nil {
logger.Warnf("unable to write end of stream: %v", err)
}
_ = bw.Flush()
}
conn.Close()
}
}