Fix: save an allocation when a stream ends.
This commit is contained in:
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)
|
||||
|
Reference in New Issue
Block a user