aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2022-11-21 13:19:12 +0100
committerLoïc Hoguin <[email protected]>2022-11-21 13:19:12 +0100
commit395490ea791cad34fd9130feb37eb145b16c1dde (patch)
tree33d1b26fda4e5f368aff212c9c14af429e48fcdb /src
parent8d51ab4e04168223b660f353b033eb3cffcee696 (diff)
downloadgun-395490ea791cad34fd9130feb37eb145b16c1dde.tar.gz
gun-395490ea791cad34fd9130feb37eb145b16c1dde.tar.bz2
gun-395490ea791cad34fd9130feb37eb145b16c1dde.zip
Enable send timeouts by default
When no TCP options are provided, Gun will enable send timeouts at 15s. The value was chosen large enough to be safe while still allowing Gun to detect send errors eventually. Different applications may need to tweak and lower this value.
Diffstat (limited to 'src')
-rw-r--r--src/gun.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gun.erl b/src/gun.erl
index bd19b7c..880a2ae 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -1022,7 +1022,10 @@ default_retry_fun(Retries, Opts) ->
domain_lookup(_, {retries, Retries, _}, State=#state{host=Host, port=Port, opts=Opts,
event_handler=EvHandler, event_handler_state=EvHandlerState0}) ->
- TransOpts = maps:get(tcp_opts, Opts, []),
+ TransOpts = maps:get(tcp_opts, Opts, [
+ {send_timeout, 15000},
+ {send_timeout_close, true}
+ ]),
DomainLookupTimeout = maps:get(domain_lookup_timeout, Opts, infinity),
DomainLookupEvent = #{
host => Host,