Compare commits
No commits in common. "31253f57084c9bb4d4ffa409b7e005cb33d36dcb" and "6e681aa3fd5dc1f5d6a9210345b466a8d7d620ee" have entirely different histories.
31253f5708
...
6e681aa3fd
@ -111,16 +111,6 @@ struct PickerStrategyRandomSequential {
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: return bytes instead, so it can be done chunk size independent
|
||||
static constexpr size_t flowWindowToRequestCount(size_t flow_window) {
|
||||
// based on 500KiB/s with ~0.05s delay looks fine
|
||||
// increase to 4 at wnd >= 25*1024
|
||||
if (flow_window >= 25*1024) {
|
||||
return 4u;
|
||||
}
|
||||
return 3u;
|
||||
}
|
||||
|
||||
void ChunkPicker::updateParticipation(
|
||||
Contact3Handle c,
|
||||
ObjectRegistry& objreg
|
||||
@ -198,7 +188,6 @@ std::vector<ChunkPicker::ContentChunkR> ChunkPicker::updateChunkRequests(
|
||||
ObjectRegistry& objreg,
|
||||
ReceivingTransfers& rt,
|
||||
const size_t open_requests
|
||||
//const size_t flow_window
|
||||
//NGCFT1& nft
|
||||
) {
|
||||
if (!static_cast<bool>(c)) {
|
||||
@ -223,12 +212,8 @@ std::vector<ChunkPicker::ContentChunkR> ChunkPicker::updateChunkRequests(
|
||||
const size_t num_ongoing_transfers = rt.sizePeer(group_number, peer_number);
|
||||
// TODO: account for open requests
|
||||
const int64_t num_total = num_ongoing_transfers + open_requests;
|
||||
|
||||
// TODO: base max on rate(chunks per sec), gonna be ass with variable chunk size
|
||||
//const size_t num_max = std::max(max_tf_chunk_requests, flowWindowToRequestCount(flow_window));
|
||||
const size_t num_max = max_tf_chunk_requests;
|
||||
|
||||
const size_t num_requests = std::max<int64_t>(0, int64_t(num_max)-num_total);
|
||||
const size_t num_requests = std::max<int64_t>(0, int64_t(max_tf_chunk_requests)-num_total);
|
||||
std::cerr << "CP: want " << num_requests << "(rt:" << num_ongoing_transfers << " or:" << open_requests << ") from " << group_number << ":" << peer_number << "\n";
|
||||
|
||||
// while n < X
|
||||
|
@ -30,7 +30,7 @@ struct ChunkPickerTimer {
|
||||
struct ChunkPicker {
|
||||
// max transfers
|
||||
static constexpr size_t max_tf_info_requests {1};
|
||||
static constexpr size_t max_tf_chunk_requests {4}; // TODO: dynamic, function/factor of (window(delay*speed)/chunksize)
|
||||
static constexpr size_t max_tf_chunk_requests {3}; // TODO: dynamic, function/factor of (window(delay*speed)/chunksize)
|
||||
|
||||
// TODO: cheaper init? tls rng for deep seeding?
|
||||
std::minstd_rand _rng{std::random_device{}()};
|
||||
@ -70,7 +70,6 @@ struct ChunkPicker {
|
||||
ObjectRegistry& objreg,
|
||||
ReceivingTransfers& rt,
|
||||
const size_t open_requests
|
||||
//const size_t flow_window
|
||||
//NGCFT1& nft
|
||||
);
|
||||
};
|
||||
|
@ -7,13 +7,11 @@
|
||||
#include <solanaceae/util/bitset.hpp>
|
||||
|
||||
#include <entt/container/dense_set.hpp>
|
||||
#include <entt/container/dense_map.hpp>
|
||||
|
||||
#include "./ft1_sha1_info.hpp"
|
||||
#include "./hash_utils.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
||||
|
||||
// TODO: rename to object components
|
||||
@ -96,34 +94,5 @@ namespace Components {
|
||||
uint64_t offset_into_file {0u};
|
||||
};
|
||||
|
||||
// this is per object/content
|
||||
// more aplicable than "separated", so should be supported by most backends
|
||||
struct TransferStats {
|
||||
// in bytes per second
|
||||
float rate_up {0.f};
|
||||
float rate_down {0.f};
|
||||
|
||||
// bytes
|
||||
uint64_t total_up {0u};
|
||||
uint64_t total_down {0u};
|
||||
};
|
||||
|
||||
struct TransferStatsSeparated {
|
||||
entt::dense_map<Contact3, TransferStats> stats;
|
||||
};
|
||||
|
||||
// used to populate stats
|
||||
struct TransferStatsTally {
|
||||
struct Peer {
|
||||
struct Entry {
|
||||
float time_since {0.f};
|
||||
size_t bytes {0u};
|
||||
};
|
||||
std::deque<Entry> recently_sent;
|
||||
std::deque<Entry> recently_received;
|
||||
};
|
||||
entt::dense_map<Contact3, Peer> tally;
|
||||
};
|
||||
|
||||
} // Components
|
||||
|
||||
|
@ -100,7 +100,7 @@ class SHA1_NGCFT1 : public ToxEventI, public RegistryMessageModelEventI, public
|
||||
bool _udp_only {false};
|
||||
|
||||
size_t _max_concurrent_in {4}; // info only
|
||||
size_t _max_concurrent_out {4*10}; // HACK: allow "ideal" number for 10 peers
|
||||
size_t _max_concurrent_out {3*4}; // HACK: allow ideal number for 4 peers
|
||||
|
||||
public:
|
||||
SHA1_NGCFT1(
|
||||
|
Loading…
Reference in New Issue
Block a user