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