|
@@ -114,9 +114,9 @@ CmdMan::CmdRet CmdMan::cmdPutdata(vector<string> args) {
|
|
|
|
|
|
root["command"] = "putdata";
|
|
|
root["file"] = fileman.getPutName();
|
|
|
- root["remaining"] = fileman.getPutChunksRemaining();
|
|
|
root["cancel"] = false;
|
|
|
root["data"] = fileman.readBase64();
|
|
|
+ root["remaining"] = fileman.getPutChunksRemaining(); // number already decremented by readBase64
|
|
|
retval.type = send;
|
|
|
retval.msg = Json::writeString(wbuilder, root);
|
|
|
|
|
@@ -278,11 +278,10 @@ CmdMan::CmdRet CmdMan::handlePutdata(Json::Value root) {
|
|
|
CmdRet retval;
|
|
|
std::cerr << __PRETTY_FUNCTION__ << " begin" << std::endl;
|
|
|
|
|
|
- // the passed number of recieved chunks should equal the number of sent chunks
|
|
|
- unsigned int sentChunks = fileman.getPutChunksRemaining()+1;
|
|
|
- if(root["received"].asUInt() != sentChunks) {
|
|
|
+ if(root["received"].asUInt() != fileman.getPutChunksRemaining()) {
|
|
|
+ // the number of remaining chunks received from the daemon does not equal the number stored at the client side
|
|
|
retval.type = error;
|
|
|
- retval.msg = std::string("File upload failed: Server reports number of sent chunks as ") + std::to_string(root["received"].asInt()) + " but actual number is " + std::to_string(sentChunks);
|
|
|
+ retval.msg = std::string("File upload failed: Server reports number of remaining chunks as ") + std::to_string(root["received"].asInt()) + " but actual number is " + std::to_string(fileman.getPutChunksRemaining());
|
|
|
} else if(root["cancel"].asBool()) {
|
|
|
retval.type = error;
|
|
|
retval.msg = "File upload cancelles: Server reports: " + root["error"].asString();
|