client: Client.setupHijackConn: explicitly ignore errors

Just making my IDE and some linters slightly happier.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-15 02:37:03 +02:00
parent 37b908aa62
commit e11555218b
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -84,8 +84,8 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto
// state. Setting TCP KeepAlive on the socket connection will prohibit // state. Setting TCP KeepAlive on the socket connection will prohibit
// ECONNTIMEOUT unless the socket connection truly is broken // ECONNTIMEOUT unless the socket connection truly is broken
if tcpConn, ok := conn.(*net.TCPConn); ok { if tcpConn, ok := conn.(*net.TCPConn); ok {
tcpConn.SetKeepAlive(true) _ = tcpConn.SetKeepAlive(true)
tcpConn.SetKeepAlivePeriod(30 * time.Second) _ = tcpConn.SetKeepAlivePeriod(30 * time.Second)
} }
clientconn := httputil.NewClientConn(conn, nil) clientconn := httputil.NewClientConn(conn, nil)
@ -100,7 +100,7 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto
return nil, "", err return nil, "", err
} }
if resp.StatusCode != http.StatusSwitchingProtocols { if resp.StatusCode != http.StatusSwitchingProtocols {
resp.Body.Close() _ = resp.Body.Close()
return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode) return nil, "", fmt.Errorf("unable to upgrade to %s, received %d", proto, resp.StatusCode)
} }
} }