diff options
-rw-r--r-- | minetest.conf.example | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/map.h | 4 | ||||
-rw-r--r-- | src/server.cpp | 15 |
4 files changed, 16 insertions, 7 deletions
diff --git a/minetest.conf.example b/minetest.conf.example index 16d9ba4e1..e6c9832a5 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -50,6 +50,6 @@ #active_object_range = 2 -#max_simultaneous_block_sends_per_client = 2 +#max_simultaneous_block_sends_per_client = 1 #max_simultaneous_block_sends_server_total = 4 diff --git a/src/main.cpp b/src/main.cpp index f7b2b2c6b..8ce19ed92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -340,7 +340,7 @@ void set_default_settings() g_settings.set("ravines_amount", "1.0");
g_settings.set("objectdata_interval", "0.2");
g_settings.set("active_object_range", "2");
- g_settings.set("max_simultaneous_block_sends_per_client", "2");
+ g_settings.set("max_simultaneous_block_sends_per_client", "1");
g_settings.set("max_simultaneous_block_sends_server_total", "4");
}
@@ -143,10 +143,10 @@ public: */ JMutexAutoLock * waitCaches() { - dstream<<"waitCaches() begin"<<std::endl; + //dstream<<"waitCaches() begin"<<std::endl; JMutexAutoLock waitcachelock(m_waitcache_mutex); JMutexAutoLock *lock = new JMutexAutoLock(m_cache_mutex); - dstream<<"waitCaches() end"<<std::endl; + //dstream<<"waitCaches() end"<<std::endl; return lock; } diff --git a/src/server.cpp b/src/server.cpp index a40352847..99683615a 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -302,8 +302,10 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime, d_start = m_nearest_unsent_d; } - u16 maximum_simultaneous_block_sends = g_settings.getU16 + u16 maximum_simultaneous_block_sends_setting = g_settings.getU16 ("max_simultaneous_block_sends_per_client"); + u16 maximum_simultaneous_block_sends = + maximum_simultaneous_block_sends_setting; /* Check the time from last addNode/removeNode. @@ -380,13 +382,20 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime, Also, don't send blocks that are already flying. */ - if(d > BLOCK_SEND_DISABLE_LIMITS_MAX_D) + + u16 maximum_simultaneous_block_sends_now = + maximum_simultaneous_block_sends; + + if(d <= BLOCK_SEND_DISABLE_LIMITS_MAX_D) + maximum_simultaneous_block_sends_now = + maximum_simultaneous_block_sends_setting; + { JMutexAutoLock lock(m_blocks_sending_mutex); // Limit is dynamically lowered when building if(m_blocks_sending.size() - >= maximum_simultaneous_block_sends) + >= maximum_simultaneous_block_sends_now) { /*dstream<<"Not sending more blocks. Queue full. " <<m_blocks_sending.size() |