Skip to content

Commit

Permalink
return false if retry has hit its limit when processing files
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-may committed May 28, 2024
1 parent d2ac700 commit e908946
Show file tree
Hide file tree
Showing 14 changed files with 2,045 additions and 2,050 deletions.
58 changes: 29 additions & 29 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
BSD 3-Clause License

Copyright (c) 2019, Electronic Arts
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
BSD 3-Clause License
Copyright (c) 2019, Electronic Arts
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286 changes: 143 additions & 143 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/EACopyClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace eacopy

enum : uint {
ClientMajorVersion = 1,
ClientMinorVersion = 17
ClientMinorVersion = 18
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
62 changes: 31 additions & 31 deletions include/EACopyDelta.h
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
// (c) Electronic Arts. All Rights Reserved.

#pragma once

#if defined(EACOPY_ALLOW_DELTA_COPY)

#include "EACopyNetwork.h"

namespace eacopy
{

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

bool sendDelta(Socket& socket, const wchar_t* referenceFileName, u64 referenceFileSize, const wchar_t* newFileName, u64 newFileSize, NetworkCopyContext& copyContext, IOStats& ioStats);


struct RecvDeltaStats
{
u64 recvTime = 0;
u64 recvSize = 0;
u64 decompressTime = 0;
};


bool receiveDelta(Socket& socket, const wchar_t* referenceFileName, u64 referenceFileSize, const wchar_t* destFileName, u64 destFileSize, FileTime lastWriteTime, NetworkCopyContext& copyContext, IOStats& ioStats, RecvDeltaStats& recvStats);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}

#endif
// (c) Electronic Arts. All Rights Reserved.

#pragma once

#if defined(EACOPY_ALLOW_DELTA_COPY)

#include "EACopyNetwork.h"

namespace eacopy
{

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

bool sendDelta(Socket& socket, const wchar_t* referenceFileName, u64 referenceFileSize, const wchar_t* newFileName, u64 newFileSize, NetworkCopyContext& copyContext, IOStats& ioStats);


struct RecvDeltaStats
{
u64 recvTime = 0;
u64 recvSize = 0;
u64 decompressTime = 0;
};


bool receiveDelta(Socket& socket, const wchar_t* referenceFileName, u64 referenceFileSize, const wchar_t* destFileName, u64 destFileSize, FileTime lastWriteTime, NetworkCopyContext& copyContext, IOStats& ioStats, RecvDeltaStats& recvStats);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}

#endif
2 changes: 1 addition & 1 deletion include/EACopyServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace eacopy

enum : uint {
ServerMajorVersion = 1,
ServerMinorVersion = 9,
ServerMinorVersion = 10,
};

enum : uint { DefaultHistorySize = 500000 }; // Number of files
Expand Down
60 changes: 30 additions & 30 deletions include/OLD_EACopyRsync.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// (c) Electronic Arts. All Rights Reserved.

#pragma once

#include "EACopyNetwork.h"

namespace eacopy
{

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct RsyncStats
{
u64 readTimeMs = 0;
u64 readSize = 0;

u64 receiveTimeMs = 0;
u64 writeTimeMs = 0;
u64 sendTimeMs = 0;
u64 sendSize = 0;

u64 rsyncTimeMs = 0;
};

bool serverHandleRsync(SOCKET socket, const wchar_t* fileName, const wchar_t* newFileName, FILETIME lastWriteTime, RsyncStats& outStats);
bool clientHandleRsync(SOCKET socket, const wchar_t* fileName, RsyncStats& outStats);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}
// (c) Electronic Arts. All Rights Reserved.

#pragma once

#include "EACopyNetwork.h"

namespace eacopy
{

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct RsyncStats
{
u64 readTimeMs = 0;
u64 readSize = 0;

u64 receiveTimeMs = 0;
u64 writeTimeMs = 0;
u64 sendTimeMs = 0;
u64 sendSize = 0;

u64 rsyncTimeMs = 0;
};

bool serverHandleRsync(SOCKET socket, const wchar_t* fileName, const wchar_t* newFileName, FILETIME lastWriteTime, RsyncStats& outStats);
bool clientHandleRsync(SOCKET socket, const wchar_t* fileName, RsyncStats& outStats);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}
8 changes: 1 addition & 7 deletions source/EACopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,6 @@ int main(int argc, char* argv_[])
logInfoLinef();
}

if (res == -1)
{
log.deinit();
return -1;
}

u64 endTime = getTime();

if (settings.printJobSummary)
Expand Down Expand Up @@ -658,7 +652,7 @@ int main(int argc, char* argv_[])
}
});

return 0;
return stats.failCount == 0 && res == 0 ? 0 : -1;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4 changes: 1 addition & 3 deletions source/EACopyClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ Client::process(Log& log, ClientStats& outStats)


// Process dirs and files (worker threads are doing the same right now)
if (!processQueues(logContext, m_sourceConnection, m_destConnection, m_copyContext, outStats, true))
return -1;
processQueues(logContext, m_sourceConnection, m_destConnection, m_copyContext, outStats, true);


// Wait for all worker threads to finish
Expand Down Expand Up @@ -452,7 +451,6 @@ Client::processFile(LogContext& logContext, Connection* sourceConnection, Connec
int retryCountLeft = m_settings.retryCount;
while (true)
{

u64 startTime = getTime();

auto reportSkip = [&]()
Expand Down
Loading

0 comments on commit e908946

Please sign in to comment.