Remove static (nil) return value.

This commit is contained in:
Maximilian Paß
2022-07-31 19:58:13 +02:00
committed by Sebastian Serth
parent 4230543d41
commit d10b31a1fb

View File

@@ -36,7 +36,7 @@ func upgradeConnection(writer http.ResponseWriter, request *http.Request) (ws.Co
// newWebSocketProxy returns an initiated and started webSocketProxy. // newWebSocketProxy returns an initiated and started webSocketProxy.
// As this proxy is already started, a start message is send to the client. // As this proxy is already started, a start message is send to the client.
func newWebSocketProxy(connection ws.Connection, proxyCtx context.Context) (*webSocketProxy, error) { func newWebSocketProxy(connection ws.Connection, proxyCtx context.Context) *webSocketProxy {
wsCtx, cancelWsCommunication := context.WithCancel(proxyCtx) wsCtx, cancelWsCommunication := context.WithCancel(proxyCtx)
proxy := &webSocketProxy{ proxy := &webSocketProxy{
ctx: wsCtx, ctx: wsCtx,
@@ -50,7 +50,7 @@ func newWebSocketProxy(connection ws.Connection, proxyCtx context.Context) (*web
cancelWsCommunication() cancelWsCommunication()
return nil return nil
}) })
return proxy, nil return proxy
} }
// waitForExit waits for an exit of either the runner (when the command terminates) or the client closing the WebSocket // waitForExit waits for an exit of either the runner (when the command terminates) or the client closing the WebSocket
@@ -91,10 +91,7 @@ func (r *RunnerController) connectToRunner(writer http.ResponseWriter, request *
} }
proxyCtx, cancelProxy := context.WithCancel(context.Background()) proxyCtx, cancelProxy := context.WithCancel(context.Background())
defer cancelProxy() defer cancelProxy()
proxy, err := newWebSocketProxy(connection, proxyCtx) proxy := newWebSocketProxy(connection, proxyCtx)
if err != nil {
return
}
log.WithField("runnerId", targetRunner.ID()). log.WithField("runnerId", targetRunner.ID()).
WithField("executionID", logging.RemoveNewlineSymbol(executionID)). WithField("executionID", logging.RemoveNewlineSymbol(executionID)).