On Thu, Feb 4, 2016 at 11:57 AM, Nick Irvine <
nfir...@nfirvine.com> wrote:
> Okay, good to know. But couldn't SetTimeout(d Duration) just be a call to
> SetDeadline(time.Now().Add(d))? SetDeadline just seems like an awkward API.
> Is there a semantic difference that I'm missing?
>
The semantic difference is that 'timeouts' generally refer to idle
time. ie. "wait this amount of time, if there isn't any activity then
timeout."
A 'deadline' refers to a time at which it should stop whether or not
it has activity.
Deadline is used here to protect against slowloris type attacks.
https://en.wikipedia.org/wiki/Slowloris_(computer_security)
SetDeadline() could have taken a Duration, but it reads weird. A
deadline usually refers to a specific time, not an amount of time from
now.