send optimization + ws file transfer test

This commit is contained in:
Benjamin Sergeant
2019-03-14 13:47:03 -07:00
parent 34de36fe01
commit 5b4354a6f3
6 changed files with 62 additions and 34 deletions

View File

@ -146,11 +146,16 @@ namespace ix
std::string filename = data["filename"].string_value();
filename = extractFilename(filename);
std::cout << "Writing to disk: " << filename << std::endl;
std::ofstream out(filename);
std::string filenameTmp = filename + ".tmp";
std::cout << "Writing to disk: " << filenameTmp << std::endl;
std::ofstream out(filenameTmp);
out.write((char*)&content.front(), content.size());
out.close();
std::cout << "Renaming " << filenameTmp << " to " << filename << std::endl;
rename(filenameTmp.c_str(), filename.c_str());
std::map<MsgPack, MsgPack> pdu;
pdu["ack"] = true;
pdu["id"] = data["id"];