Is there an existing issue for this?
Current Behavior
If the deadline argument is deadline.IsZero() then 1000 hours are used instead:
|
|
|
d := 1000 * time.Hour |
|
if !deadline.IsZero() { |
|
d = time.Until(deadline) |
|
if d < 0 { |
|
return errWriteTimeout |
|
} |
|
} |
|
|
Expected Behavior
Behaviour should be documented and better design decision has to be made:
Either:
- ignore zero as invalid argument: return
errWriteTimeout.
- ignore zero deadline: The maximum possible deadline should be used, not arbitrary value of 1000 hours.
- respect zero as valid deadline: Fail request immediately.
Steps To Reproduce
Call WriteControl with a zero-deadline but fail to respond for ~41 days.
This is rather theoretical, but a non-conformant websocket or bad firewall might lead to this.
Anything else?
Originally reported in #841 (comment).
Confirmed as "unexpected" by maintainer in #841 (comment).
In practice probably doesn't affect anybody; it's just weird.