void CUpdater::ProcessNotification(std::unique_ptr<CNotification> && notification) { if (state_ != UpdaterState::checking && state_ != UpdaterState::newversion_downloading) { return; } switch (notification->GetID()) { case nId_asyncrequest: { auto pData = unique_static_cast<CAsyncRequestNotification>(std::move(notification)); if (pData->GetRequestID() == reqId_fileexists) { static_cast<CFileExistsNotification *>(pData.get())->overwriteAction = CFileExistsNotification::resume; } else if (pData->GetRequestID() == reqId_certificate) { auto & certNotification = static_cast<CCertificateNotification &>(*pData.get()); if (m_use_internal_rootcert) { auto certs = certNotification.GetCertificates(); if( certs.size() > 1 ) { auto ca = certs.back(); unsigned int ca_data_length{}; unsigned char const* ca_data = ca.GetRawData(ca_data_length); wxMemoryBuffer updater_root = wxBase64Decode(s_update_cert, wxNO_LEN, wxBase64DecodeMode_SkipWS); if( ca_data_length == updater_root.GetDataLen() && !memcmp(ca_data, updater_root.GetData(), ca_data_length) ) { certNotification.m_trusted = true; } } } else { certNotification.m_trusted = true; } } engine_->SetAsyncRequestReply(std::move(pData)); } break; case nId_data: ProcessData(static_cast<CDataNotification&>(*notification.get())); break; case nId_operation: ProcessOperation(static_cast<COperationNotification const&>(*notification.get())); break; case nId_logmsg: { auto const& msg = static_cast<CLogmsgNotification const&>(*notification.get()); log_ += msg.msg + _T("\n"); } break; default: break; } }
const string& CRequestContext::SetSessionID(void) { CNcbiOstrstream oss; CDiagContext& ctx = GetDiagContext(); oss << ctx.GetStringUID(ctx.UpdateUID()) << '_' << setw(4) << setfill('0') << GetRequestID() << "SID"; SetSessionID(CNcbiOstrstreamToString(oss)); return m_SessionID.GetOriginalString(); }