upd: ready to fix read in half way of write

This commit is contained in:
2023-12-12 07:29:45 +00:00
parent a7fcafca83
commit ffb1a5f788
4 changed files with 41 additions and 4 deletions

View File

@ -1,5 +1,6 @@
#include "schedule.h"
#include <iostream>
#include <random>
#include <sstream>
@ -29,6 +30,29 @@ void BookStoreBackEndClass::Run() {
session_map[new_SessionToken] = new_session;
(*output_ptr) << TempChannelID << " IinitialOpt 1\n"
<< new_SessionToken << ' ' << new_AuthenticationKey << '\n';
} else if (request_data[1] == 'C') {
;
} else if (request_data[1] == '_') {
;
} else if (request_data[1] == 'S') {
;
} else if (request_data[1] == 'R') {
std::stringstream ss(request_data);
std::string SessionToken;
std::string OperationToken;
std::string OuthenticationKey;
std::string cmd;
ss >> cmd >> SessionToken >> OperationToken >> OuthenticationKey;
ss.get();
std::getline(ss, cmd);
debugPrint("SessionToken=", SessionToken,
" OperationToken=", OperationToken,
" OuthenticationKey=", OuthenticationKey, " cmd=", cmd);
// (*output_ptr) << SessionToken << ' ' << OperationToken << " 0\n";
(*output_ptr) << SessionToken << ' ' << OperationToken
<< " 1\nECHO: " << cmd << '\n';
// std::cerr << "[]" << SessionToken << ' ' << OperationToken
// << " 1\nECHO: " << cmd << '\n';
}
}
}