From 2e013e3408e0b48aacbdb1e78021ee56d6ed996a Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Wed, 31 May 2017 15:39:19 +0200 Subject: [PATCH] mediaapi/writers/download: Remove unnecessary closeConnection() --- .../dendrite/mediaapi/writers/download.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go index c67e0a4e..9f66409c 100644 --- a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go +++ b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go @@ -208,22 +208,7 @@ func (r *downloadRequest) respondFromLocalFile(w http.ResponseWriter, absBasePat } } // If we have written any data then we have already responded with 200 OK and all we can do is close the connection - // FIXME: close the connection here or just return? - r.closeConnection(w) + return nil } return nil } - -func (r *downloadRequest) closeConnection(w http.ResponseWriter) { - r.Logger.Info("Attempting to close the connection.") - hijacker, ok := w.(http.Hijacker) - if ok { - connection, _, hijackErr := hijacker.Hijack() - if hijackErr == nil { - r.Logger.Info("Closing") - connection.Close() - } else { - r.Logger.WithError(hijackErr).Warn("Error trying to hijack and close connection") - } - } -}