summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-11-27 17:18:34 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-11-27 17:18:34 +0200
commit24c4b7c68d283a4d1de72a3eb68f1268f1fe34e3 (patch)
treec65ee918cc55d7a631aa312a24cc34bb8dea47b4 /src/client.cpp
parent4e249fb3fbf75f0359758760d88e22aa5b14533c (diff)
downloadminetest-24c4b7c68d283a4d1de72a3eb68f1268f1fe34e3.tar.gz
minetest-24c4b7c68d283a4d1de72a3eb68f1268f1fe34e3.tar.bz2
minetest-24c4b7c68d283a4d1de72a3eb68f1268f1fe34e3.zip
Working version before block send priorization update
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/client.cpp b/src/client.cpp
index ee3269974..a4f0ffb07 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -14,10 +14,6 @@
#define sleep_ms(x) usleep(x*1000)
#endif
-/*
- FIXME: This thread can access the environment at any time
-*/
-
void * ClientUpdateThread::Thread()
{
ThreadStarted();
@@ -144,6 +140,22 @@ void Client::step(float dtime)
m_con.RunTimeouts(dtime);
}
+ /*
+ Packet counter
+ */
+ {
+ static float counter = -0.001;
+ counter -= dtime;
+ if(counter <= 0.0)
+ {
+ counter = 10.0;
+
+ dout_client<<"Client packetcounter:"<<std::endl;
+ m_packetcounter.print(dout_client);
+ m_packetcounter.clear();
+ }
+ }
+
{
/*
Delete unused sectors
@@ -171,7 +183,9 @@ void Client::step(float dtime)
if(num > 0)
{
- dstream<<DTIME<<"Client: Deleted blocks of "<<num
+ /*dstream<<DTIME<<"Client: Deleted blocks of "<<num
+ <<" unused sectors"<<std::endl;*/
+ dstream<<DTIME<<"Client: Deleted "<<num
<<" unused sectors"<<std::endl;
/*
@@ -433,11 +447,18 @@ void Client::Receive()
void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
{
DSTACK(__FUNCTION_NAME);
+
// Ignore packets that don't even fit a command
if(datasize < 2)
+ {
+ m_packetcounter.add(60000);
return;
+ }
ToClientCommand command = (ToClientCommand)readU16(&data[0]);
+
+ //dstream<<"Client: received command="<<command<<std::endl;
+ m_packetcounter.add((u16)command);
/*
If this check is removed, be sure to change the queue