Skip to content

Commit

Permalink
set http request header 'Connection' to 'Keep-Alive' to reuse tcp con…
Browse files Browse the repository at this point in the history
…nection for avoiding large TIME_WAIT on full-node, full-node need set 'jsonrpc_http_keep_alive=true', otherwise it will still set 'Connection' to 'Close' in http response of full-node (#76)

Co-authored-by: dayong <[email protected]>
  • Loading branch information
wangdayong228 and dayong authored May 12, 2021
1 parent e1761ee commit 9a3e8d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ func DialHTTPWithClient(endpoint string, client *fasthttp.Client) (*Client, erro
req.Header.SetMethod("POST")
req.Header.Set("Content-Type", contentType)
req.Header.Set("Accept", contentType)
req.Header.Set("Connection", "close")
// req.Header.Set("Connection", "close")
req.Header.Set("Connection", "Keep-Alive")
return &httpConn{client: client, req: &req, closeCh: make(chan interface{})}, nil
})
}
Expand Down

0 comments on commit 9a3e8d2

Please sign in to comment.