1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Network cleanup (#6302)

* Cleanup network headers

* Move peerhandler to a specific header to reduce compilation times
* Move socket.cpp/h to network folder

* More work

* Network code cleanups

* Move socket.{cpp,h} to network folder
* Move Address object to network/address.{cpp,h}
* Move network exceptions to network/networkexceptions.h
* Client: use unique_ptr for Connection
* Server/ClientIface: use shared_ptr for Connection

* Format fixes

* Remove socket.cpp socket.h from clang-format whitelist

* Also fix NetworkPacket code style & make it under clang-format
This commit is contained in:
Loïc Blot 2017-08-24 08:28:54 +02:00 committed by GitHub
parent 928609c8bd
commit c7160cb629
27 changed files with 1059 additions and 924 deletions

View file

@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once
#include "network/connection.h"
#include "clientenvironment.h"
#include "irrlichttypes_extrabloated.h"
#include <ostream>
@ -36,6 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapnode.h"
#include "tileanimation.h"
#include "mesh_generator_thread.h"
#include "network/address.h"
#include "network/peerhandler.h"
#include <fstream>
#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
@ -57,6 +58,9 @@ class Minimap;
struct MinimapMapblock;
class Camera;
class NetworkPacket;
namespace con {
class Connection;
}
enum LocalClientState {
LC_Created,
@ -472,8 +476,7 @@ public:
u8 getProtoVersion()
{ return m_proto_ver; }
bool connectedToServer()
{ return m_con.Connected(); }
bool connectedToServer();
float mediaReceiveProgress();
@ -539,10 +542,7 @@ public:
void showGameFog(bool show = true);
void showGameDebug(bool show = true);
const Address getServerAddress()
{
return m_con.GetPeerAddress(PEER_ID_SERVER);
}
const Address getServerAddress();
const std::string &getAddressName() const
{
@ -611,7 +611,7 @@ private:
MeshUpdateThread m_mesh_update_thread;
ClientEnvironment m_env;
ParticleManager m_particle_manager;
con::Connection m_con;
std::unique_ptr<con::Connection> m_con;
std::string m_address_name;
Camera *m_camera = nullptr;
Minimap *m_minimap = nullptr;