summaryrefslogtreecommitdiffstats
path: root/app/server.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-10-12 08:00:53 -0700
committerGitHub <noreply@github.com>2017-10-12 08:00:53 -0700
commit3461a7b20704464ee3c19a3dd31805e4c5c1fc4f (patch)
treeb14ad4935a9453157024e638b5c468a1833e0eae /app/server.go
parent521e27f4ace125b47879b38edbad07d7c21a54e6 (diff)
downloadchat-3461a7b20704464ee3c19a3dd31805e4c5c1fc4f.tar.gz
chat-3461a7b20704464ee3c19a3dd31805e4c5c1fc4f.tar.bz2
chat-3461a7b20704464ee3c19a3dd31805e4c5c1fc4f.zip
Add back consumeAndClose functionality. (#7608)
* consume bodies for action button integrations, webrtc gateway, oauth endpoint * Fixing a couple more places, switching to io.Copy to ioutil.Discard, adding a comment to help prevent future performance regressions
Diffstat (limited to 'app/server.go')
-rw-r--r--app/server.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/server.go b/app/server.go
index 3802c2eec..c509d0440 100644
--- a/app/server.go
+++ b/app/server.go
@@ -5,6 +5,8 @@ package app
import (
"crypto/tls"
+ "io"
+ "io/ioutil"
"net"
"net/http"
"strings"
@@ -208,3 +210,11 @@ func (a *App) StopServer() {
a.Srv.GracefulServer = nil
}
}
+
+// This is required to re-use the underlying connection and not take up file descriptors
+func consumeAndClose(r *http.Response) {
+ if r.Body != nil {
+ io.Copy(ioutil.Discard, r.Body)
+ r.Body.Close()
+ }
+}