#4740 Used the same chunk size for secure and non-secure sockets

This commit is contained in:
XinyuHou 2016-09-01 11:28:32 +01:00 committed by Andrew Nelless
parent 3e1a86c3c1
commit 82043ca435
3 changed files with 3 additions and 19 deletions

View File

@ -326,7 +326,6 @@ ArgParser::parseGenericArgs(int argc, const char* const* argv, int& i)
}
else if (isArg(i, argc, argv, NULL, "--enable-crypto")) {
argsBase().m_enableCrypto = true;
StreamChunker::updateChunkSize(true);
}
else if (isArg(i, argc, argv, NULL, "--profile-dir", 1)) {
argsBase().m_profileDirectory = argv[++i];

View File

@ -37,10 +37,8 @@
using namespace std;
#define SOCKET_CHUNK_SIZE 512 * 1024; // 512kb
#define SECURE_SOCKET_CHUNK_SIZE 2 * 1024; // 2kb
#define CHUNK_SIZE 512 * 1024; // 512kb
size_t StreamChunker::s_chunkSize = SOCKET_CHUNK_SIZE;
bool StreamChunker::s_isChunkingClipboard = false;
bool StreamChunker::s_interruptClipboard = false;
bool StreamChunker::s_isChunkingFile = false;
@ -73,7 +71,7 @@ StreamChunker::sendFile(
// send chunk messages with a fixed chunk size
size_t sentLength = 0;
size_t chunkSize = s_chunkSize;
size_t chunkSize = CHUNK_SIZE;
Stopwatch sendStopwatch;
sendStopwatch.start();
file.seekg (0, std::ios::beg);
@ -141,7 +139,7 @@ StreamChunker::sendClipboard(
// send clipboard chunk with a fixed size
size_t sentLength = 0;
size_t chunkSize = s_chunkSize;
size_t chunkSize = CHUNK_SIZE;
Stopwatch sendStopwatch;
sendStopwatch.start();
@ -189,17 +187,6 @@ StreamChunker::sendClipboard(
s_isChunkingClipboard = false;
}
void
StreamChunker::updateChunkSize(bool useSecureSocket)
{
if (useSecureSocket) {
s_chunkSize = SECURE_SOCKET_CHUNK_SIZE;
}
else {
s_chunkSize = SOCKET_CHUNK_SIZE;
}
}
void
StreamChunker::interruptFile()
{

View File

@ -36,12 +36,10 @@ public:
UInt32 sequence,
IEventQueue* events,
void* eventTarget);
static void updateChunkSize(bool useSecureSocket);
static void interruptFile();
static void setClipboardInterrupt(bool interrupt);
private:
static size_t s_chunkSize;
static bool s_isChunkingClipboard;
static bool s_interruptClipboard;
static bool s_isChunkingFile;