Compare commits
No commits in common. "60d6f27a125ad74e20e43999f8ddff4e2e6eb152" and "9e2911b36c2864c2bc90bb083045562d7148631c" have entirely different histories.
60d6f27a12
...
9e2911b36c
@ -11,8 +11,7 @@ void SendingTransfers::tick(float delta) {
|
|||||||
// if we have not heard for 10min, timeout (lower level event on real timeout)
|
// if we have not heard for 10min, timeout (lower level event on real timeout)
|
||||||
// (2min was too little, so it seems)
|
// (2min was too little, so it seems)
|
||||||
// TODO: do we really need this if we get events?
|
// TODO: do we really need this if we get events?
|
||||||
// FIXME: disabled for now, we are trusting ngcft1 for now
|
if (it->second.time_since_activity >= 60.f*10.f) {
|
||||||
if (false && it->second.time_since_activity >= 60.f*10.f) {
|
|
||||||
std::cerr << "SHA1_NGCFT1 warning: sending tansfer timed out " << "." << int(it->first) << "\n";
|
std::cerr << "SHA1_NGCFT1 warning: sending tansfer timed out " << "." << int(it->first) << "\n";
|
||||||
assert(false);
|
assert(false);
|
||||||
it = peer_it->second.erase(it);
|
it = peer_it->second.erase(it);
|
||||||
|
@ -1372,7 +1372,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) {
|
|||||||
// we might not know yet
|
// we might not know yet
|
||||||
if (addParticipation(c, o)) {
|
if (addParticipation(c, o)) {
|
||||||
// something happend, update chunk picker
|
// something happend, update chunk picker
|
||||||
//c.emplace_or_replace<ChunkPickerUpdateTag>();
|
c.emplace_or_replace<ChunkPickerUpdateTag>();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& remote_have = o.get_or_emplace<Components::RemoteHaveBitset>().others;
|
auto& remote_have = o.get_or_emplace<Components::RemoteHaveBitset>().others;
|
||||||
@ -1381,17 +1381,14 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) {
|
|||||||
remote_have.emplace(c, Components::RemoteHaveBitset::Entry{false, num_total_chunks});
|
remote_have.emplace(c, Components::RemoteHaveBitset::Entry{false, num_total_chunks});
|
||||||
|
|
||||||
// new have? nice
|
// new have? nice
|
||||||
//c.emplace_or_replace<ChunkPickerUpdateTag>();
|
// (always update on biset, not always on have)
|
||||||
|
c.emplace_or_replace<ChunkPickerUpdateTag>();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& remote_have_peer = remote_have.at(c);
|
auto& remote_have_peer = remote_have.at(c);
|
||||||
if (remote_have_peer.have_all) {
|
if (!remote_have_peer.have_all) {
|
||||||
return true; // peer somehow already had all, ignoring
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(remote_have_peer.have.size_bits() >= num_total_chunks);
|
assert(remote_have_peer.have.size_bits() >= num_total_chunks);
|
||||||
|
|
||||||
bool a_valid_change {false};
|
|
||||||
for (const auto c_i : e.chunks) {
|
for (const auto c_i : e.chunks) {
|
||||||
if (c_i >= num_total_chunks) {
|
if (c_i >= num_total_chunks) {
|
||||||
std::cerr << "SHA1_NGCFT1 error: remote sent have with out-of-range chunk index!!!\n";
|
std::cerr << "SHA1_NGCFT1 error: remote sent have with out-of-range chunk index!!!\n";
|
||||||
@ -1401,12 +1398,6 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) {
|
|||||||
|
|
||||||
assert(c_i < num_total_chunks);
|
assert(c_i < num_total_chunks);
|
||||||
remote_have_peer.have.set(c_i);
|
remote_have_peer.have.set(c_i);
|
||||||
a_valid_change = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a_valid_change) {
|
|
||||||
// new have? nice
|
|
||||||
c.emplace_or_replace<ChunkPickerUpdateTag>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for completion?
|
// check for completion?
|
||||||
@ -1424,6 +1415,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) {
|
|||||||
remote_have_peer.have_all = true;
|
remote_have_peer.have_all = true;
|
||||||
remote_have_peer.have = BitSet{};
|
remote_have_peer.have = BitSet{};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1499,6 +1491,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_bitset& e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// new have? nice
|
// new have? nice
|
||||||
|
// (always update on bitset, not always on have)
|
||||||
c.emplace_or_replace<ChunkPickerUpdateTag>();
|
c.emplace_or_replace<ChunkPickerUpdateTag>();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1537,6 +1530,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have_all& e) {
|
|||||||
remote_have[c] = Components::RemoteHaveBitset::Entry{true, {}};
|
remote_have[c] = Components::RemoteHaveBitset::Entry{true, {}};
|
||||||
|
|
||||||
// new have? nice
|
// new have? nice
|
||||||
|
// (always update on have_all, not always on have)
|
||||||
c.emplace_or_replace<ChunkPickerUpdateTag>();
|
c.emplace_or_replace<ChunkPickerUpdateTag>();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user