diff --git a/src/modules/Workers/WebService/WebService.cpp b/src/modules/Workers/WebService/WebService.cpp index c357e55..cad2128 100644 --- a/src/modules/Workers/WebService/WebService.cpp +++ b/src/modules/Workers/WebService/WebService.cpp @@ -1627,13 +1627,21 @@ namespace Apostol { CHTTPRequest::Prepare(ARequest, "GET", CString().Format("/api/v1/key/public?account=%s&type=pgp", PGP.Name.c_str()).c_str()); ARequest->AddHeader("Authorization", "Bearer " + m_Tokens[SYSTEM_PROVIDER_NAME]["access_token"]); + + DebugRequest(ARequest); }; auto OnExecute = [this, &PGP](CTCPConnection *AConnection) { auto pConnection = dynamic_cast (AConnection); + + if (pConnection == nullptr) + return true; + auto pReply = pConnection->Reply(); + DebugReply(pReply); + try { PGP.StatusTime = Now(); PGP.Status = CKeyContext::ksError; @@ -1670,17 +1678,25 @@ namespace Apostol { } pConnection->CloseConnection(true); + return true; }; auto OnException = [this, &PGP](CTCPConnection *AConnection, const Delphi::Exception::Exception &E) { auto pConnection = dynamic_cast (AConnection); - auto pClient = dynamic_cast (pConnection->Client()); - Log()->Error(APP_LOG_EMERG, 0, "[%s:%d] %s", pClient->Host().c_str(), pClient->Port(), E.what()); + if (pConnection != nullptr) { + auto pClient = dynamic_cast (pConnection->Client()); - PGP.Status = CKeyContext::ksError; - m_RandomDate = Now() + (CDateTime) 5 / SecsPerDay; + if (pClient != nullptr) { + Log()->Error(APP_LOG_EMERG, 0, "[%s:%d] %s", pClient->Host().c_str(), pClient->Port(), E.what()); + + PGP.Status = CKeyContext::ksError; + m_RandomDate = Now() + (CDateTime) 5 / SecsPerDay; + } + + DebugReply(pConnection->Reply()); + } }; CLocation Location(caServerContext.URI);