Skip to content

Instantly share code, notes, and snippets.

@sapier
Last active January 3, 2016 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sapier/8406393 to your computer and use it in GitHub Desktop.
Save sapier/8406393 to your computer and use it in GitHub Desktop.
diff --git a/src/client.cpp b/src/client.cpp
index 1c7ecf3..e50804f 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1016,6 +1016,14 @@ void Client::Receive()
}
//TimeTaker t1("ProcessData", m_device);
ProcessData(*data, datasize, sender_peer_id);
+
+ if(m_server_ser_ver != SER_FMT_VER_INVALID) {
+ while(m_queued_packets.size() > 0) {
+ SharedBuffer<u8> toprocess = m_queued_packets.front();
+ m_queued_packets.erase(m_queued_packets.begin());
+ ProcessData(*toprocess,toprocess.getSize(),PEER_ID_SERVER);
+ }
+ }
}
/*
@@ -1133,6 +1141,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
infostream<<"Client: Server serialization"
" format invalid or not initialized."
" Skipping incoming command="<<command<<std::endl;
+ m_queued_packets.push_back(SharedBuffer<u8>(data,datasize));
return;
}
diff --git a/src/client.h b/src/client.h
index 1b7ad48..6d1913f 100644
--- a/src/client.h
+++ b/src/client.h
@@ -521,6 +521,8 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
// Storage for mesh data for creating multiple instances of the same mesh
std::map<std::string, std::string> m_mesh_data;
+
+ std::vector< SharedBuffer<u8> > m_queued_packets;
};
#endif // !CLIENT_HEADER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment