fix: error in IO
This commit is contained in:
@ -4,5 +4,6 @@ file(GLOB_RECURSE main_src backend/src/*.cpp)
|
|||||||
include_directories(${PROJECT_SOURCE_DIR}/backend/include)
|
include_directories(${PROJECT_SOURCE_DIR}/backend/include)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/external)
|
include_directories(${PROJECT_SOURCE_DIR}/external)
|
||||||
add_executable(code ${main_src})
|
add_executable(code ${main_src})
|
||||||
|
target_compile_options(code PRIVATE -Ofast)
|
||||||
add_subdirectory(maintenance/test)
|
add_subdirectory(maintenance/test)
|
||||||
include(maintenance/test/ctest_config)
|
include(maintenance/test/ctest_config)
|
@ -35,16 +35,16 @@ void BookStoreMain(bool is_server, std::string config_dir) {
|
|||||||
input.readlock();
|
input.readlock();
|
||||||
input << "#Request " << SessionToken << " I-T-D" << ++cnt << " "
|
input << "#Request " << SessionToken << " I-T-D" << ++cnt << " "
|
||||||
<< AuthenticationKey << ' ' << cmd << '\n';
|
<< AuthenticationKey << ' ' << cmd << '\n';
|
||||||
assert(input.internalStream.peek() != EOF);
|
// assert(input.internalStream.peek() != EOF);
|
||||||
input.unreadlock();
|
input.unreadlock();
|
||||||
assert(input.is_writing == false);
|
// assert(input.is_writing == false);
|
||||||
debugPrint("Sent Request ", cnt, " cmd=", cmd);
|
// debugPrint("Sent Request ", cnt, " cmd=", cmd);
|
||||||
std::string SessionToken;
|
std::string SessionToken;
|
||||||
std::string OperationToken;
|
std::string OperationToken;
|
||||||
int LineCounter;
|
int LineCounter;
|
||||||
output >> SessionToken >> OperationToken >> LineCounter;
|
output >> SessionToken >> OperationToken >> LineCounter;
|
||||||
debugPrint("Get the Head of response id=", OperationToken,
|
// debugPrint("Get the Head of response id=", OperationToken,
|
||||||
" LineCounter=", LineCounter);
|
// " LineCounter=", LineCounter);
|
||||||
// debugPrint("Get SessionToken=", SessionToken,
|
// debugPrint("Get SessionToken=", SessionToken,
|
||||||
// " OperationToken=", OperationToken,
|
// " OperationToken=", OperationToken,
|
||||||
// " LineCounter=", LineCounter);
|
// " LineCounter=", LineCounter);
|
||||||
@ -53,7 +53,7 @@ void BookStoreMain(bool is_server, std::string config_dir) {
|
|||||||
output.getline(tmp);
|
output.getline(tmp);
|
||||||
std::cout << tmp << std::endl;
|
std::cout << tmp << std::endl;
|
||||||
// std::cerr << tmp << std::endl;
|
// std::cerr << tmp << std::endl;
|
||||||
debugPrint(tmp);
|
// debugPrint(tmp);
|
||||||
}
|
}
|
||||||
// std::cout.flush();
|
// std::cout.flush();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ void BookStoreBackEndClass::Run() {
|
|||||||
std::mt19937 rnd(RndSeed);
|
std::mt19937 rnd(RndSeed);
|
||||||
while (true) {
|
while (true) {
|
||||||
input_ptr->getline(request_data, '\n');
|
input_ptr->getline(request_data, '\n');
|
||||||
debugPrint("Get_request_data=", request_data);
|
// debugPrint("Get_request_data=", request_data);
|
||||||
if (request_data[1] == 'O') // #OpenSession [TempChannelID]
|
if (request_data[1] == 'O') // #OpenSession [TempChannelID]
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -32,10 +32,10 @@ void BookStoreBackEndClass::Run() {
|
|||||||
(*output_ptr).readlock();
|
(*output_ptr).readlock();
|
||||||
(*output_ptr) << TempChannelID << " IinitialOpt 1\n"
|
(*output_ptr) << TempChannelID << " IinitialOpt 1\n"
|
||||||
<< new_SessionToken << ' ' << new_AuthenticationKey << '\n';
|
<< new_SessionToken << ' ' << new_AuthenticationKey << '\n';
|
||||||
assert((*output_ptr).internalStream.peek() != EOF);
|
// assert((*output_ptr).internalStream.peek() != EOF);
|
||||||
(*output_ptr).unreadlock();
|
(*output_ptr).unreadlock();
|
||||||
assert((*output_ptr).is_writing == false);
|
// assert((*output_ptr).is_writing == false);
|
||||||
debugPrint("Sent Response Init");
|
// debugPrint("Sent Response Init");
|
||||||
} else if (request_data[1] == 'C') {
|
} else if (request_data[1] == 'C') {
|
||||||
;
|
;
|
||||||
} else if (request_data[1] == '_') {
|
} else if (request_data[1] == '_') {
|
||||||
@ -57,10 +57,10 @@ void BookStoreBackEndClass::Run() {
|
|||||||
(*output_ptr).readlock();
|
(*output_ptr).readlock();
|
||||||
(*output_ptr) << SessionToken << ' ' << OperationToken << " 1\n"
|
(*output_ptr) << SessionToken << ' ' << OperationToken << " 1\n"
|
||||||
<< cmd << '\n';
|
<< cmd << '\n';
|
||||||
assert((*output_ptr).internalStream.peek() != EOF);
|
// assert((*output_ptr).internalStream.peek() != EOF);
|
||||||
(*output_ptr).unreadlock();
|
(*output_ptr).unreadlock();
|
||||||
assert((*output_ptr).is_writing == false);
|
// assert((*output_ptr).is_writing == false);
|
||||||
debugPrint("Sent Response id=", OperationToken);
|
// debugPrint("Sent Response id=", OperationToken);
|
||||||
// debugPrint(SessionToken, ' ', OperationToken, " 1\n", cmd);
|
// debugPrint(SessionToken, ' ', OperationToken, " 1\n", cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user