From 050f25256c964ff6a5dc7df78d05fc4f98df0366 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 13 Apr 2019 22:51:46 +0100
Subject: [PATCH] Fix an error when io.CopyBuffer returns n=0

It could be that the "n=0 means EOF" semantics are leaking from the
underlying splice() system call? Anyway this prevents radiod from
getting stuck in a busy loop in certain(?) cases.
---
 node/proxy.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/node/proxy.go b/node/proxy.go
index 0096b30c..737a1a56 100644
--- a/node/proxy.go
+++ b/node/proxy.go
@@ -175,6 +175,10 @@ func copyStream(tag string, out, in *net.TCPConn, promCounter prometheus.Counter
 			}
 			return
 		}
+		if n == 0 {
+			log.Printf("http: proxy got 0 bytes from splice()")
+			return
+		}
 	}
 }
 
-- 
GitLab