[Merge] lp:~marcustomlinson/net-cpp/fix_ppc_timeout into lp:net-cpp

Marcus Tomlinson marcus.tomlinson at canonical.com
Fri Jan 23 06:24:44 UTC 2015


> Here is a diff that does this:
> 
> === modified file 'src/core/net/http/impl/curl/request.h'
> --- src/core/net/http/impl/curl/request.h       2014-11-13 13:16:42 +0000
> +++ src/core/net/http/impl/curl/request.h       2015-01-23 05:16:35 +0000
> @@ -109,7 +109,11 @@
>          if (atomic_state.load() != core::net::http::Request::State::ready)
>              throw
> core::net::http::Request::Errors::AlreadyActive{CORE_FROM_HERE()};
> 
> -        easy.set_option(::curl::Option::timeout_ms, timeout.count());
> +        // timeout.count() is a long long, but curl uses varargs and wants a
> long.
> +        // If timeout.count() overflows a long, we wait forever instead of
> roughly 24.8 days.
> +        auto count = timeout.count();
> +        long adjusted_timeout = count <= std::numeric_limits<long>::max() ?
> count : 0;
> +        easy.set_option(::curl::Option::timeout_ms, adjusted_timeout);
>      }
> 
>      Response execute(const Request::ProgressHandler& ph)

Awesome, thanks for that. Done.
-- 
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