Skip to content

Instantly share code, notes, and snippets.

@sapier

sapier/gist:8406393

Last active Jan 3, 2016
Embed
What would you like to do?
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