Fix: save an allocation when a stream ends.
This commit is contained in:
parent
4bb97ee43a
commit
fed6b92227
2
main.go
2
main.go
|
@ -143,11 +143,11 @@ func upstreamFiber(name string) {
|
|||
})()
|
||||
body := r.Body
|
||||
for {
|
||||
buff := make([]byte, 65536)
|
||||
if ctx.viewer == 0 {
|
||||
fmt.Printf("No active viewers for %s, stopping reading from upstream.\n", name)
|
||||
break
|
||||
}
|
||||
buff := make([]byte, 65536)
|
||||
n, err := body.Read(buff)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Upstream for stream %s request reached EOF\n", name)
|
||||
|
|
Loading…
Reference in New Issue