RemoteStore::addToStore(): Ensure capacity is decreased on exceptions
This commit is contained in:
parent
a4c1618876
commit
3c2de9830d
1 changed files with 5 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
#include "derivations.hh"
|
#include "derivations.hh"
|
||||||
#include "pool.hh"
|
#include "pool.hh"
|
||||||
|
#include "finally.hh"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -439,8 +440,10 @@ Path RemoteStore::addToStore(const string & name, const Path & _srcPath,
|
||||||
conn->to.written = 0;
|
conn->to.written = 0;
|
||||||
conn->to.warn = true;
|
conn->to.warn = true;
|
||||||
connections->incCapacity();
|
connections->incCapacity();
|
||||||
dumpPath(srcPath, conn->to, filter);
|
{
|
||||||
connections->decCapacity();
|
Finally cleanup([&]() { connections->decCapacity(); });
|
||||||
|
dumpPath(srcPath, conn->to, filter);
|
||||||
|
}
|
||||||
conn->to.warn = false;
|
conn->to.warn = false;
|
||||||
conn->processStderr();
|
conn->processStderr();
|
||||||
} catch (SysError & e) {
|
} catch (SysError & e) {
|
||||||
|
|
Loading…
Reference in a new issue