aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-08-14 14:57:59 +0200
committerLoïc Hoguin <[email protected]>2017-08-14 14:57:59 +0200
commit0fe54af72b81fdb198a377198d7f3a91f9ad6d7c (patch)
treed7b7d5e014f0b2311fd3301e609bca20c15d278f /src/gun.erl
parent6dc280be003c5bb648f4ea26f7a7670c62295c3f (diff)
downloadgun-0fe54af72b81fdb198a377198d7f3a91f9ad6d7c.tar.gz
gun-0fe54af72b81fdb198a377198d7f3a91f9ad6d7c.tar.bz2
gun-0fe54af72b81fdb198a377198d7f3a91f9ad6d7c.zip
Allow an infinity keepalive value1.0.0-pre.4
This disables the keepalive mechanism entirely.
Diffstat (limited to 'src/gun.erl')
-rw-r--r--src/gun.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gun.erl b/src/gun.erl
index 4857344..e9155b2 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -624,7 +624,10 @@ before_loop(State=#state{opts=Opts, protocol=Protocol}) ->
end,
ProtoOpts = maps:get(ProtoOptsKey, Opts, #{}),
Keepalive = maps:get(keepalive, ProtoOpts, 5000),
- KeepaliveRef = erlang:send_after(Keepalive, self(), keepalive),
+ KeepaliveRef = case Keepalive of
+ infinity -> undefined;
+ _ -> erlang:send_after(Keepalive, self(), keepalive)
+ end,
loop(State#state{keepalive_ref=KeepaliveRef}).
loop(State=#state{parent=Parent, owner=Owner, owner_ref=OwnerRef, host=Host, port=Port, opts=Opts,