Skip to content

Instantly share code, notes, and snippets.

@tnachen
Last active November 6, 2015 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnachen/990b1b0bb0c9e7f8d23c to your computer and use it in GitHub Desktop.
Save tnachen/990b1b0bb0c9e7f8d23c to your computer and use it in GitHub Desktop.
Diff for review 39340
diff --git a/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp b/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
index a8edf13..2d486dc 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
@@ -625,18 +625,15 @@ Future<size_t> RegistryClientProcess::saveBlob(
{
return reader.read()
.then([this, fd, reader, totalSize](
- const string& data) mutable -> Future<size_t> {
+ const string& data) -> Future<size_t> {
if (data.empty()) {
return totalSize;
}
- size_t length = data.length();
- return _saveBlob(fd, data.data(), length)
- .then([this, fd, reader, length, totalSize](
- ) mutable -> Future<size_t> {
- totalSize += length;
-
- return saveBlob(fd, const_cast<Pipe::Reader&>(reader), totalSize);
+ size_t newTotalSize = totalSize + data.length();
+ return _saveBlob(fd, data.data(), newTotalSize)
+ .then([this, fd, reader, newTotalSize]() -> Future<size_t> {
+ return saveBlob(fd, const_cast<Pipe::Reader&>(reader), newTotalSize);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment