[Merge] lp:~marcustomlinson/net-cpp/fix_ppc_timeout into lp:net-cpp
Michi Henning
michi.henning at canonical.com
Wed Jan 21 22:47:09 UTC 2015
Review: Needs Fixing
I'm having second thoughts about this fix as it stands. If someone accidentally passes a duration that is greater than numeric_limits<long>::max() (such as the epoch), we'll wait a random amount of time (possibly not at all or a very short amount of time), depending on the exact value.
I can see three options:
- Check if the passed value overflows and silently clamp to numeric_limits<long>::max()
- Check if the passed value overflows and silently adjust to "wait forever"
- Throw an exception
I'm slightly in favour of the second option. That's because the max value amounts to a wait time of a little over 24 days. If someone is prepared to wait that long for an HTTP request to complete, it is probably safe to assume that they are willing to wait forever.
Also, a comment mentioning that the cast is necessary because set_option() uses varargs would be good. (It's not obvious, unless someone studies the curl doc rather carefully.)
--
https://code.launchpad.net/~marcustomlinson/net-cpp/fix_ppc_timeout/+merge/247100
Your team Ubuntu Phablet Team is subscribed to branch lp:net-cpp.
More information about the Ubuntu-reviews
mailing list