Skip to content

Commit

Permalink
Validate that write timeout is greater than connection timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
iksaif committed May 27, 2024
1 parent 0649aa0 commit 1785ac4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions statsd/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ func parseAgentURL(agentURL string) string {

func createWriter(addr string, writeTimeout time.Duration, connectTimeout time.Duration) (Transport, string, error) {
addr = resolveAddr(addr)
if writeTimeout > connectTimeout {
return nil, "", errors.New("write timeout cannot be greater than connect timeout")
}
if addr == "" {
return nil, "", errors.New("No address passed and autodetection from environment failed")
}
Expand Down

0 comments on commit 1785ac4

Please sign in to comment.