small tweaks to get the progressbar going (sometimes o.o)

This commit is contained in:
Green Sky 2023-08-18 18:39:19 +02:00
parent 8c221a3e17
commit 96669e0202
No known key found for this signature in database

View File

@ -135,6 +135,9 @@ void SHA1_NGCFT1::updateMessages(ContentHandle ce) {
if (ce.all_of<Message::Components::Transfer::BytesSent>()) {
msg.emplace_or_replace<Message::Components::Transfer::BytesSent>(ce.get<Message::Components::Transfer::BytesSent>());
}
if (ce.all_of<Message::Components::Transfer::BytesReceived>()) {
msg.emplace_or_replace<Message::Components::Transfer::BytesReceived>(ce.get<Message::Components::Transfer::BytesReceived>());
}
if (ce.all_of<Message::Components::Transfer::TagPaused>()) {
msg.emplace_or_replace<Message::Components::Transfer::TagPaused>();
} else {
@ -482,6 +485,8 @@ bool SHA1_NGCFT1::onEvent(const Message::Events::MessageUpdated& e) {
// now, enque
_queue_content_want_chunk.push_back(ce);
ce.remove<Message::Components::Transfer::TagPaused>();
// should?
e.e.remove<Message::Components::Transfer::ActionAccept>();
@ -822,12 +827,13 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_done& e) {
cc.have_chunk.clear(); // not wasting memory
std::cout << "SHA1_NGCFT1: got all chunks for \n" << info << "\n";
}
// good chunk
// TODO: have wasted + metadata
ce.get_or_emplace<Message::Components::Transfer::BytesReceived>().total += chunk_data.size();
} else {
std::cout << "SHA1_NGCFT1 warning: got chunk duplicate\n";
}
// good chunk
ce.get_or_emplace<Message::Components::Transfer::BytesReceived>().total += chunk_data.size();
} else {
// bad chunk
// TODO: requeue?