about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstore/download.cc5
-rw-r--r--src/libstore/download.hh2
-rw-r--r--src/libstore/gc.cc2
-rw-r--r--src/libstore/local-store.hh11
-rw-r--r--src/libstore/store-api.cc2
-rw-r--r--src/libstore/store-api.hh7
6 files changed, 12 insertions, 17 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index d1f760fdc301..f8f578695033 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -300,6 +300,11 @@ struct CurlDownloader : public Downloader
                         || httpStatus == 504  || httpStatus == 522 || httpStatus == 524
                         || code == CURLE_COULDNT_RESOLVE_HOST
                         || code == CURLE_RECV_ERROR
+
+                        // this seems to occur occasionally for retriable reasons, and shows up in an error like this:
+                        //   curl: (23) Failed writing body (315 != 16366)
+                        || code == CURLE_WRITE_ERROR
+
                         // this is a generic SSL failure that in some cases (e.g., certificate error) is permanent but also appears in transient cases, so we consider it retryable
                         || code == CURLE_SSL_CONNECT_ERROR
 #if LIBCURL_VERSION_NUM >= 0x073200
diff --git a/src/libstore/download.hh b/src/libstore/download.hh
index e2e16b361036..62f3860b9dae 100644
--- a/src/libstore/download.hh
+++ b/src/libstore/download.hh
@@ -15,7 +15,7 @@ struct DownloadRequest
     bool verifyTLS = true;
     enum { yes, no, automatic } showProgress = yes;
     bool head = false;
-    size_t tries = 1;
+    size_t tries = 5;
     unsigned int baseRetryTimeMs = 250;
 
     DownloadRequest(const std::string & uri) : uri(uri) { }
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 8e90913cc3f1..0b03d61a789a 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -679,7 +679,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
         if (unlink(path.c_str()) == -1)
             throw SysError(format("deleting ‘%1%’") % path);
 
-        state.results.bytesFreed += st.st_blocks * 512;
+        state.results.bytesFreed += st.st_blocks * 512ULL;
     }
 
     struct stat st;
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 28e9a31c9feb..750da0c142d3 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -26,14 +26,9 @@ struct Derivation;
 
 struct OptimiseStats
 {
-    unsigned long filesLinked;
-    unsigned long long bytesFreed;
-    unsigned long long blocksFreed;
-    OptimiseStats()
-    {
-        filesLinked = 0;
-        bytesFreed = blocksFreed = 0;
-    }
+    unsigned long filesLinked = 0;
+    unsigned long long bytesFreed = 0;
+    unsigned long long blocksFreed = 0;
 };
 
 
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 59348c5d0b5f..53c802044ea6 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -731,7 +731,7 @@ StoreType getStoreType(const std::string & uri, const std::string & stateDir)
         return tDaemon;
     } else if (uri == "local") {
         return tLocal;
-    } else if (uri == "") {
+    } else if (uri == "" || uri == "auto") {
         if (access(stateDir.c_str(), R_OK | W_OK) == 0)
             return tLocal;
         else if (pathExists(settings.nixDaemonSocketFile))
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 68c59a9f2922..c0a52145af53 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -81,12 +81,7 @@ struct GCResults
 
     /* For `gcReturnDead', `gcDeleteDead' and `gcDeleteSpecific', the
        number of bytes that would be or was freed. */
-    unsigned long long bytesFreed;
-
-    GCResults()
-    {
-        bytesFreed = 0;
-    }
+    unsigned long long bytesFreed = 0;
 };