mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-10-30 02:12:29 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -42,69 +42,54 @@ namespace OpenWifi {
|
|||||||
uint64_t ID = Payload->get(uCentralProtocol::ID);
|
uint64_t ID = Payload->get(uCentralProtocol::ID);
|
||||||
std::shared_ptr<promise_type_t> TmpRpcEntry;
|
std::shared_ptr<promise_type_t> TmpRpcEntry;
|
||||||
poco_debug(Logger(),fmt::format("({}): Processing {} response.", SerialNumberStr, ID));
|
poco_debug(Logger(),fmt::format("({}): Processing {} response.", SerialNumberStr, ID));
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
if (ID > 1) {
|
if (ID > 1) {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
std::lock_guard Lock(LocalMutex_);
|
std::lock_guard Lock(LocalMutex_);
|
||||||
auto RPC = OutStandingRequests_.find(ID);
|
auto RPC = OutStandingRequests_.find(ID);
|
||||||
if (RPC == OutStandingRequests_.end() ||
|
if (RPC == OutStandingRequests_.end() ||
|
||||||
RPC->second.SerialNumber != Resp->SerialNumber_) {
|
RPC->second.SerialNumber != Resp->SerialNumber_) {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
poco_debug(Logger(),
|
poco_debug(Logger(),
|
||||||
fmt::format("({}): RPC {} completed.", SerialNumberStr, ID));
|
fmt::format("({}): RPC {} completed.", SerialNumberStr, ID));
|
||||||
} else {
|
} else {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
std::chrono::duration<double, std::milli> rpc_execution_time =
|
std::chrono::duration<double, std::milli> rpc_execution_time =
|
||||||
std::chrono::high_resolution_clock::now() -
|
std::chrono::high_resolution_clock::now() -
|
||||||
RPC->second.submitted;
|
RPC->second.submitted;
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
|
|
||||||
poco_debug(Logger(),
|
poco_debug(Logger(),
|
||||||
fmt::format("({}): Received RPC answer {}. Command={}",
|
fmt::format("({}): Received RPC answer {}. Command={}",
|
||||||
SerialNumberStr, ID, APCommands::to_string(RPC->second.Command)));
|
SerialNumberStr, ID, APCommands::to_string(RPC->second.Command)));
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
if(RPC->second.Command==APCommands::Commands::script) {
|
if(RPC->second.Command==APCommands::Commands::script) {
|
||||||
if(RPC->second.State==2) {
|
if(RPC->second.State==2) {
|
||||||
// look at the payload to see if we should continue or not...
|
// look at the payload to see if we should continue or not...
|
||||||
if (RPC->second.rpc_entry) {
|
if (RPC->second.rpc_entry) {
|
||||||
TmpRpcEntry = RPC->second.rpc_entry;
|
TmpRpcEntry = RPC->second.rpc_entry;
|
||||||
}
|
}
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
|
|
||||||
Payload->stringify(std::cout);
|
// Payload->stringify(std::cout);
|
||||||
|
|
||||||
if (Payload->has("result")) {
|
if (Payload->has("result")) {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
auto Result = Payload->getObject("result");
|
auto Result = Payload->getObject("result");
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
if (Result->has("status")) {
|
if (Result->has("status")) {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
auto Status = Result->getObject("status");
|
auto Status = Result->getObject("status");
|
||||||
Status->stringify(std::cout);
|
// Status->stringify(std::cout);
|
||||||
std::uint64_t Error = Status->get("error");
|
std::uint64_t Error = Status->get("error");
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
if(Error==0) {
|
if(Error==0) {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
||||||
rpc_execution_time, true);
|
rpc_execution_time, true);
|
||||||
RPC->second.State = 1 ;
|
RPC->second.State = 1 ;
|
||||||
} else {
|
} else {
|
||||||
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
||||||
rpc_execution_time, true);
|
rpc_execution_time, true);
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
std::string ErrorTxt = Status->get("result");
|
std::string ErrorTxt = Status->get("result");
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
StorageService()->CancelWaitFile(RPC->second.UUID, ErrorTxt);
|
StorageService()->CancelWaitFile(RPC->second.UUID, ErrorTxt);
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
RPC->second.State = 0 ;
|
RPC->second.State = 0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Bad payload on command result" << std::endl;
|
// std::cout << "Bad payload on command result" << std::endl;
|
||||||
RPC->second.State=0;
|
RPC->second.State=0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Completing script 2 phase commit." << std::endl;
|
// std::cout << "Completing script 2 phase commit." << std::endl;
|
||||||
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
||||||
rpc_execution_time, true);
|
rpc_execution_time, true);
|
||||||
NoReply = true;
|
NoReply = true;
|
||||||
@@ -114,18 +99,14 @@ namespace OpenWifi {
|
|||||||
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
StorageService()->CommandCompleted(RPC->second.UUID, Payload,
|
||||||
rpc_execution_time, true);
|
rpc_execution_time, true);
|
||||||
if (RPC->second.rpc_entry) {
|
if (RPC->second.rpc_entry) {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
TmpRpcEntry = RPC->second.rpc_entry;
|
TmpRpcEntry = RPC->second.rpc_entry;
|
||||||
}
|
}
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
RPC->second.State = 0 ;
|
RPC->second.State = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RPC->second.State==0) {
|
if(RPC->second.State==0) {
|
||||||
std::cout << __LINE__ << std::endl;
|
|
||||||
OutStandingRequests_.erase(ID);
|
OutStandingRequests_.erase(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!NoReply && TmpRpcEntry != nullptr)
|
if(!NoReply && TmpRpcEntry != nullptr)
|
||||||
TmpRpcEntry->set_value(Payload);
|
TmpRpcEntry->set_value(Payload);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
struct UploadId {
|
struct UploadId {
|
||||||
std::string UUID;
|
std::string UUID;
|
||||||
std::uint64_t Expires;
|
std::uint64_t Expires;
|
||||||
std::string Type;
|
std::string Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user