handle transfer done event, now has propper speed
This commit is contained in:
parent
6a802475c1
commit
f429feaaa8
@ -564,6 +564,13 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_data_ack& e) {
|
||||
// delete if all packets acked
|
||||
if (transfer.file_size == transfer.file_size_current && transfer.ssb.size() == 0) {
|
||||
std::cout << "NGCFT1: " << int(e.transfer_id) << " done\n";
|
||||
dispatch(
|
||||
NGCFT1_Event::send_done,
|
||||
Events::NGCFT1_send_done{
|
||||
e.group_number, e.peer_number,
|
||||
e.transfer_id,
|
||||
}
|
||||
);
|
||||
peer.send_transfers[e.transfer_id].reset();
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,8 @@ SHA1_NGCFT1::SHA1_NGCFT1(
|
||||
_nft.subscribe(this, NGCFT1_Event::recv_init);
|
||||
_nft.subscribe(this, NGCFT1_Event::recv_data);
|
||||
_nft.subscribe(this, NGCFT1_Event::send_data);
|
||||
_nft.subscribe(this, NGCFT1_Event::recv_done);
|
||||
_nft.subscribe(this, NGCFT1_Event::send_done);
|
||||
|
||||
//_rmm.subscribe(this, RegistryMessageModel_Event::message_construct);
|
||||
//_rmm.subscribe(this, RegistryMessageModel_Event::message_updated);
|
||||
@ -354,6 +356,25 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_send_data& e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_done& e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_send_done& e) {
|
||||
if (!_sending_transfers.count(combineIds(e.group_number, e.peer_number))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& peer_transfers = _sending_transfers.at(combineIds(e.group_number, e.peer_number));
|
||||
if (!peer_transfers.count(e.transfer_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
peer_transfers.erase(e.transfer_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SHA1_NGCFT1::sendFilePath(const Contact3 c, std::string_view file_name, std::string_view file_path) {
|
||||
if (
|
||||
// TODO: add support of offline queuing
|
||||
|
@ -77,6 +77,8 @@ class SHA1_NGCFT1 : public RegistryMessageModelEventI, public NGCFT1EventI {
|
||||
bool onEvent(const Events::NGCFT1_recv_init&) override;
|
||||
bool onEvent(const Events::NGCFT1_recv_data&) override;
|
||||
bool onEvent(const Events::NGCFT1_send_data&) override; // const?
|
||||
bool onEvent(const Events::NGCFT1_recv_done&) override;
|
||||
bool onEvent(const Events::NGCFT1_send_done&) override;
|
||||
|
||||
bool sendFilePath(const Contact3 c, std::string_view file_name, std::string_view file_path) override;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user