Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Adjust some log in aktualizr_secondary
Browse files Browse the repository at this point in the history
Co-Authored-By: Patrick Vacek <patrickvacek@gmail.com>
Signed-off-by: cheng.xiang <ext-cheng.xiang@here.com>
  • Loading branch information
xcheng-here and pattivacek committed Mar 24, 2020
1 parent fdafed8 commit 4e9a0f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/aktualizr_secondary/aktualizr_secondary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ bool AktualizrSecondary::sendFirmware(const std::string& firmware) {
return false;
}

LOG_INFO << "Download firmware " << pending_target_.filename() << " successful.";
return true;
}

Expand Down Expand Up @@ -198,6 +199,7 @@ bool AktualizrSecondary::doFullVerification(const Metadata& metadata) {

pending_target_ = targetsForThisEcu[0];

LOG_DEBUG << "Metadata verified, new update found.";
return true;
}

Expand Down Expand Up @@ -246,7 +248,7 @@ void AktualizrSecondary::uptaneInitialize() {

void AktualizrSecondary::initPendingTargetIfAny() {
if (!director_repo_.checkMetaOffline(*storage_)) {
LOG_INFO << "No valid and pending Director targets to be applied";
LOG_INFO << "No valid metadata found in storage.";
return;
}

Expand Down
7 changes: 4 additions & 3 deletions src/aktualizr_secondary/secondary_tcp_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SecondaryTcpServer::SecondaryTcpServer(Uptane::SecondaryInterface &secondary, co

ConnectionSocket conn_socket(primary_ip, primary_port, listen_socket_.port());
if (conn_socket.connect() == 0) {
LOG_INFO << "Connected to Primary, sending info about this secondary...";
LOG_INFO << "Connected to Primary, sending info about this Secondary...";
HandleOneConnection(*conn_socket);
} else {
LOG_INFO << "Failed to connect to Primary";
Expand All @@ -34,7 +34,7 @@ void SecondaryTcpServer::run() {
sockaddr_storage peer_sa{};
socklen_t peer_sa_size = sizeof(sockaddr_storage);

LOG_DEBUG << "Waiting for connection from client...";
LOG_DEBUG << "Waiting for connection from Primary...";
int con_fd = accept(*listen_socket_, reinterpret_cast<sockaddr *>(&peer_sa), &peer_sa_size);
if (con_fd == -1) {
LOG_INFO << "Socket accept failed. aborting";
Expand Down Expand Up @@ -146,14 +146,15 @@ bool SecondaryTcpServer::HandleOneConnection(int socket) {
r->result = ok ? AKInstallationResult_success : AKInstallationResult_failure;
} break;
case AKIpUptaneMes_PR_sendFirmwareReq: {
LOG_INFO << "Received sendFirmwareReq from Primary.";
auto fw = msg->sendFirmwareReq();
auto send_firmware_result = impl_.sendFirmware(ToString(fw->firmware));
resp->present(AKIpUptaneMes_PR_sendFirmwareResp);
auto r = resp->sendFirmwareResp();
r->result = send_firmware_result ? AKInstallationResult_success : AKInstallationResult_failure;
LOG_INFO << "Download " << (send_firmware_result ? "successful" : "failed") << ".";
} break;
case AKIpUptaneMes_PR_installReq: {
LOG_INFO << "Received installReq from Primary.";
auto request = msg->installReq();

auto install_result = impl_.install(ToString(request->hash));
Expand Down

0 comments on commit 4e9a0f7

Please sign in to comment.