Skip to content
Snippets Groups Projects
Commit 2e851904 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

data_transfer: cancelIce_ is not used anymore

Because all file transfers are down through channeled sockets,
cancelIce_ is not used anymore and a file is cancelled when
the linked channel is down.

Change-Id: Icbb075149ea61660bee0a9013b5cd87bc0eb2463
parent b0209b79
No related branches found
No related tags found
No related merge requests found
......@@ -508,15 +508,6 @@ public:
return newTransfer;
}
bool cancel(bool channeled)
{
if (channeled)
cancelChanneled_ = true;
else
cancelIce_ = true;
return cancelChanneled_ && cancelIce_;
}
bool hasBeenStarted() const override
{
// Started if one subtransfer is started
......@@ -537,9 +528,6 @@ public:
private:
OutgoingFileTransfer() = delete;
std::atomic_bool cancelChanneled_ {false};
std::atomic_bool cancelIce_ {false};
mutable std::shared_ptr<OptimisticMetaOutgoingInfo> metaInfo_;
mutable std::ifstream input_;
mutable std::vector<std::shared_ptr<SubOutgoingFileTransfer>> subtransfer_;
......@@ -568,9 +556,8 @@ OutgoingFileTransfer::OutgoingFileTransfer(DRing::DataTransferId tid,
void
OutgoingFileTransfer::close() noexcept
{
if (cancelChanneled_ && cancelIce_)
for (const auto& subtransfer : subtransfer_)
subtransfer->close();
for (const auto& subtransfer : subtransfer_)
subtransfer->close();
}
//==============================================================================
......@@ -848,8 +835,7 @@ DataTransferFacade::sendFile(const DRing::DataTransferInfo& info,
},
[this, tid]() {
if (auto transfer = pimpl_->getTransfer(tid))
if (std::dynamic_pointer_cast<OutgoingFileTransfer>(transfer)->cancel(true)
and not transfer->hasBeenStarted()) {
if (not transfer->hasBeenStarted()) {
transfer->emit(DRing::DataTransferEventCode::unjoinable_peer);
pimpl_->cancel(*transfer);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment