Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 17, 2024
1 parent 30ddd38 commit aa217d0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,39 +139,39 @@ namespace wrench {

WRENCH_DEBUG("Got a [%s] message", message->getName().c_str());

if (auto msg = std::dynamic_pointer_cast<ServiceStopDaemonMessage>(message)) {
return processStopDaemonRequest(msg->ack_commport);
if (auto ssd_msg = std::dynamic_pointer_cast<ServiceStopDaemonMessage>(message)) {
return processStopDaemonRequest(ssd_msg->ack_commport);

} else if (auto msg = std::dynamic_pointer_cast<StorageServiceFreeSpaceRequestMessage>(message)) {
return processFreeSpaceRequest(msg->answer_commport, msg->path);
} else if (auto ssfsr_msg = std::dynamic_pointer_cast<StorageServiceFreeSpaceRequestMessage>(message)) {
return processFreeSpaceRequest(ssfsr_msg->answer_commport, ssfsr_msg->path);

} else if (auto msg = std::dynamic_pointer_cast<StorageServiceFileDeleteRequestMessage>(message)) {
return processFileDeleteRequest(msg->location, msg->answer_commport);
} else if (auto ssfdr_msg = std::dynamic_pointer_cast<StorageServiceFileDeleteRequestMessage>(message)) {
return processFileDeleteRequest(ssfdr_msg->location, ssfdr_msg->answer_commport);

} else if (auto msg = std::dynamic_pointer_cast<StorageServiceFileLookupRequestMessage>(message)) {
return processFileLookupRequest(msg->location, msg->answer_commport);
} else if (auto ssflr_msg = std::dynamic_pointer_cast<StorageServiceFileLookupRequestMessage>(message)) {
return processFileLookupRequest(ssflr_msg->location, ssflr_msg->answer_commport);

} else if (auto msg = std::dynamic_pointer_cast<StorageServiceFileWriteRequestMessage>(message)) {
return processFileWriteRequest(msg->location, msg->num_bytes_to_write, msg->answer_commport);
} else if (auto ssfwr_msg = std::dynamic_pointer_cast<StorageServiceFileWriteRequestMessage>(message)) {
return processFileWriteRequest(ssfwr_msg->location, ssfwr_msg->num_bytes_to_write, ssfwr_msg->answer_commport);

} else if (auto msg = std::dynamic_pointer_cast<StorageServiceFileReadRequestMessage>(message)) {
return processFileReadRequest(msg->location, msg->num_bytes_to_read, msg->answer_commport);
} else if (auto ssfrr_msg = std::dynamic_pointer_cast<StorageServiceFileReadRequestMessage>(message)) {
return processFileReadRequest(ssfrr_msg->location, ssfrr_msg->num_bytes_to_read, ssfrr_msg->answer_commport);

} else if (auto msg = std::dynamic_pointer_cast<StorageServiceFileCopyRequestMessage>(message)) {
return processFileCopyRequest(msg->src, msg->dst, msg->answer_commport);
} else if (auto ssfcr_msg = std::dynamic_pointer_cast<StorageServiceFileCopyRequestMessage>(message)) {
return processFileCopyRequest(ssfcr_msg->src, ssfcr_msg->dst, ssfcr_msg->answer_commport);

} else if (auto msg = std::dynamic_pointer_cast<FileTransferThreadNotificationMessage>(message)) {
} else if (auto fttn_msg = std::dynamic_pointer_cast<FileTransferThreadNotificationMessage>(message)) {
return processFileTransferThreadNotification(
msg->file_transfer_thread,
msg->src_commport,
msg->src_location,
msg->dst_commport,
msg->dst_location,
msg->success,
msg->failure_cause,
msg->answer_commport_if_read,
msg->answer_commport_if_write,
msg->answer_commport_if_copy);
fttn_msg->file_transfer_thread,
fttn_msg->src_commport,
fttn_msg->src_location,
fttn_msg->dst_commport,
fttn_msg->dst_location,
fttn_msg->success,
fttn_msg->failure_cause,
fttn_msg->answer_commport_if_read,
fttn_msg->answer_commport_if_write,
fttn_msg->answer_commport_if_copy);
} else {
throw std::runtime_error(
"SimpleStorageServiceBufferized::processNextMessage(): Unexpected [" + message->getName() + "] message");
Expand Down Expand Up @@ -448,12 +448,12 @@ namespace wrench {
}

// Send back the relevant ack if this was a read
if (ftt->dst_location == nullptr and success) {
if (success and ftt->dst_location == nullptr) {
ftt->answer_commport_if_read->dputMessage(new StorageServiceAckMessage(ftt->src_location));
} else if (ftt->src_location == nullptr and success) {
} else if (success and ftt->src_location == nullptr) {
ftt->answer_commport_if_write->dputMessage(new StorageServiceAckMessage(ftt->dst_location));
} else {
if (ftt->dst_location->getStorageService() == shared_from_this()) {
if (success and ftt->dst_location->getStorageService() == shared_from_this()) {
WRENCH_INFO("File %s stored", ftt->dst_location->getFile()->getID().c_str());
try {
this->simulation_->getOutput().addTimestampFileCopyCompletion(
Expand All @@ -462,15 +462,15 @@ namespace wrench {
}
}

// WRENCH_INFO("Sending back an ack for a file copy");
ftt->answer_commport_if_copy->dputMessage(
new StorageServiceFileCopyAnswerMessage(
ftt->src_location,
ftt->dst_location,
true,
nullptr,
this->getMessagePayloadValue(
SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD)));
// WRENCH_INFO("Sending back an ack for a file copy");
ftt->answer_commport_if_copy->dputMessage(
new StorageServiceFileCopyAnswerMessage(
ftt->src_location,
ftt->dst_location,
success,
nullptr,
this->getMessagePayloadValue(
SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD)));
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ void StorageServiceLinkFailuresTest::do_StorageServiceLinkFailureSimpleRandom_Te

// Create and initialize a simulation
auto simulation = wrench::Simulation::createSimulation();
int argc = 4;
int argc = 5;
char **argv = (char **) calloc(argc, sizeof(char *));
argv[0] = strdup("unit_test");
argv[1] = strdup("--wrench-link-shutdown-simulation");
argv[2] = strdup("--cfg=contexts/stack-size:50");
argv[3] = strdup("--wrench-default-control-message-size=10");
// argv[2] = strdup("--wrench-commport-pool-size=100000");
// argv[4] = strdup("--wrench-full-log");
argv[4] = strdup("--wrench-full-log");

simulation->init(&argc, argv);

Expand Down

0 comments on commit aa217d0

Please sign in to comment.