Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rely on max_simultaneous_block_sends_per_client to limit blocks sent …
…to the client.
  • Loading branch information
lhofhansl committed Oct 14, 2020
1 parent 2f871e3 commit f43d1cf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
18 changes: 1 addition & 17 deletions src/clientiface.cpp
Expand Up @@ -99,7 +99,6 @@ void RemoteClient::GetNextBlocks (
{
// Increment timers
m_nothing_to_send_pause_timer -= dtime;
m_nearest_unsent_reset_timer += dtime;

if (m_nothing_to_send_pause_timer >= 0)
return;
Expand Down Expand Up @@ -154,14 +153,6 @@ void RemoteClient::GetNextBlocks (
/*infostream<<"m_nearest_unsent_reset_timer="
<<m_nearest_unsent_reset_timer<<std::endl;*/

// Reset periodically to workaround for some bugs or stuff
if (m_nearest_unsent_reset_timer > 20.0f) {
m_nearest_unsent_reset_timer = 0.0f;
m_nearest_unsent_d = 0;
//infostream<<"Resetting m_nearest_unsent_d for "
// <<server->getPlayerName(peer_id)<<std::endl;
}

//s16 last_nearest_unsent_d = m_nearest_unsent_d;
s16 d_start = m_nearest_unsent_d;

Expand Down Expand Up @@ -212,16 +203,9 @@ void RemoteClient::GetNextBlocks (
wanted_range);
const s16 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE;

s16 d_max = full_d_max;
s16 d_max_gen = std::min(adjustDist(m_max_gen_distance, prop_zoom_fov),
wanted_range);

// Don't loop very much at a time, adjust with distance,
// do more work per RTT with greater distances.
s16 max_d_increment_at_time = full_d_max / 9 + 1;
if (d_max > d_start + max_d_increment_at_time)
d_max = d_start + max_d_increment_at_time;

// cos(angle between velocity and camera) * |velocity|
// Limit to 0.0f in case player moves backwards.
f32 dot = rangelim(camera_dir.dotProduct(playerspeed), 0.0f, 300.0f);
Expand All @@ -238,7 +222,7 @@ void RemoteClient::GetNextBlocks (
const v3s16 cam_pos_nodes = floatToInt(camera_pos, BS);

s16 d;
for (d = d_start; d <= d_max; d++) {
for (d = d_start; d <= full_d_max; d++) {
/*
Get the border/face dot coordinates of a "d-radiused"
box
Expand Down
1 change: 0 additions & 1 deletion src/clientiface.h
Expand Up @@ -364,7 +364,6 @@ class RemoteClient
std::set<v3s16> m_blocks_sent;
s16 m_nearest_unsent_d = 0;
v3s16 m_last_center;
float m_nearest_unsent_reset_timer = 0.0f;

const u16 m_max_simul_sends;
const float m_min_time_from_building;
Expand Down

0 comments on commit f43d1cf

Please sign in to comment.