aboutsummaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-11-27 18:10:11 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-11-27 18:10:11 +0200
commite8fd5eb8eebbf12b0561d385ef8bc245d87e9ea6 (patch)
treef6141532d76528cbba6da0d57cc74133fbae3ba1 /src/server.h
parent24c4b7c68d283a4d1de72a3eb68f1268f1fe34e3 (diff)
downloadhax-minetest-server-e8fd5eb8eebbf12b0561d385ef8bc245d87e9ea6.tar.gz
hax-minetest-server-e8fd5eb8eebbf12b0561d385ef8bc245d87e9ea6.zip
block send priority queue
Diffstat (limited to '')
-rw-r--r--src/server.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/server.h b/src/server.h
index c178480d5..8e2e05626 100644
--- a/src/server.h
+++ b/src/server.h
@@ -208,11 +208,11 @@ u32 PIChecksum(core::list<PlayerInfo> &l);
*/
struct PrioritySortedBlockTransfer
{
- PrioritySortedBlockTransfer(float a_priority, v3s16 a_pos, u16 a_dest_peer)
+ PrioritySortedBlockTransfer(float a_priority, v3s16 a_pos, u16 a_peer_id)
{
priority = a_priority;
pos = a_pos;
- dest_peer = a_dest_peer;
+ peer_id = a_peer_id;
}
bool operator < (PrioritySortedBlockTransfer &other)
{
@@ -220,7 +220,7 @@ struct PrioritySortedBlockTransfer
}
float priority;
v3s16 pos;
- u16 a_dest_peer;
+ u16 peer_id;
};
class RemoteClient
@@ -252,8 +252,13 @@ public:
{
}
- // Connection and environment should be locked when this is called
- void SendBlocks(Server *server, float dtime);
+ /*
+ Finds block that should be sent next to the client.
+ Environment should be locked when this is called.
+ dtime is used for resetting send radius at slow interval
+ */
+ void GetNextBlocks(Server *server, float dtime,
+ core::array<PrioritySortedBlockTransfer> &dest);
// Connection and environment should be locked when this is called
// steps() objects of blocks not found in active_blocks, then
@@ -272,6 +277,18 @@ public:
void SetBlocksNotSent(core::map<v3s16, MapBlock*> &blocks);
void BlockEmerged();
+
+ /*bool IsSendingBlock(v3s16 p)
+ {
+ JMutexAutoLock lock(m_blocks_sending_mutex);
+ return (m_blocks_sending.find(p) != NULL);
+ }*/
+
+ s32 SendingCount()
+ {
+ JMutexAutoLock lock(m_blocks_sending_mutex);
+ return m_blocks_sending.size();
+ }
// Increments timeouts and removes timed-out blocks from list
// NOTE: This doesn't fix the server-not-sending-block bug