Skip to content
Permalink
Browse files

Add propper client initialization

  -add client states to avoid server sending data to uninitialized clients
  -don't show uninitialized clients to other players
  -propper client disconnect handling
Minor comment fixes in server
Minor bugfixes in connection
  -improved peer id calculation
  -honor NDEBUG flag
  -improved disconnect handling
  -increased initial send window
Remove some dead code
  • Loading branch information
sapier sapier
sapier authored and sapier committed Jan 31, 2014
1 parent 21f1bec commit e258675eabc874d31bc9c6cf49e4bbc1f7f3f417
Showing with 1,799 additions and 1,590 deletions.
  1. +1 −0 src/CMakeLists.txt
  2. +1 −17 src/client.cpp
  3. +769 −0 src/clientiface.cpp
  4. +306 −0 src/clientiface.h
  5. +1 −7 src/clientmedia.cpp
  6. +106 −64 src/connection.cpp
  7. +24 −20 src/connection.h
  8. +2 −13 src/emerge.cpp
  9. +538 −1,210 src/server.cpp
  10. +51 −259 src/server.h
@@ -308,6 +308,7 @@ set(common_SRCS
connection.cpp
environment.cpp
server.cpp
clientiface.cpp
socket.cpp
mapblock.cpp
mapsector.cpp
@@ -383,13 +383,6 @@ void Client::step(float dtime)
// 0ms
ReceiveAll();
}

{
//TimeTaker timer("m_con_mutex + m_con.RunTimeouts()", m_device);
// 0ms
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
m_con.RunTimeouts(dtime);
}

/*
Packet counter
@@ -758,6 +751,7 @@ void Client::step(float dtime)
if (m_media_downloader && m_media_downloader->isStarted()) {
m_media_downloader->step(this);
if (m_media_downloader->isDone()) {
received_media();
delete m_media_downloader;
m_media_downloader = NULL;
}
@@ -1610,11 +1604,6 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
}

m_media_downloader->step(this);
if (m_media_downloader->isDone()) {
// might be done already if all media is in the cache
delete m_media_downloader;
m_media_downloader = NULL;
}
}
else if(command == TOCLIENT_MEDIA)
{
@@ -1666,11 +1655,6 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
m_media_downloader->conventionalTransferDone(
name, data, this);
}

if (m_media_downloader->isDone()) {
delete m_media_downloader;
m_media_downloader = NULL;
}
}
else if(command == TOCLIENT_TOOLDEF)
{

0 comments on commit e258675

Please sign in to comment.
You can’t perform that action at this time.