From d0a2db17d91931cfd8d60e93d30cee20d39762c8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 22 Dec 2016 17:39:05 +0100 Subject: [PATCH] Call Aws::InitAPI This is required now. --- src/libstore/s3-binary-cache-store.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index 5361bd9da..ccb71f1ee 100644 --- a/src/libstore/s3-binary-cache-store.cc +++ b/src/libstore/s3-binary-cache-store.cc @@ -8,14 +8,15 @@ #include "nar-info-disk-cache.hh" #include "globals.hh" +#include #include #include #include #include #include #include -#include #include +#include namespace nix { @@ -47,6 +48,20 @@ R && checkAws(const FormatOrString & fs, Aws::Utils::Outcome && outcome) return outcome.GetResultWithOwnership(); } +static void initAWS() +{ + static std::once_flag flag; + std::call_once(flag, []() { + Aws::SDKOptions options; + + /* We install our own OpenSSL locking function (see + shared.cc), so don't let aws-sdk-cpp override it. */ + options.cryptoOptions.initAndCleanupOpenSSL = false; + + Aws::InitAPI(options); + }); +} + struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore { std::string bucketName; @@ -73,6 +88,7 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore ref makeConfig() { + initAWS(); auto res = make_ref(); res->region = Aws::Region::US_EAST_1; // FIXME: make configurable res->requestTimeoutMs = 600 * 1000;