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 "irr_v3d.h"
#include "map.h"
#include "hud.h"
@ -29,6 +28,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "inventorymanager.h"
#include "subgame.h"
#include "tileanimation.h" // struct TileAnimationParams
#include "network/peerhandler.h"
#include "network/address.h"
#include "util/numeric.h"
#include "util/thread.h"
#include "util/basic_macros.h"
@ -291,8 +292,7 @@ public:
void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);
const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const;
inline Address getPeerAddress(u16 peer_id)
{ return m_con.GetPeerAddress(peer_id); }
Address getPeerAddress(u16 peer_id);
bool setLocalPlayerAnimations(RemotePlayer *player, v2s32 animation_frames[4],
f32 frame_speed);
@ -320,7 +320,7 @@ public:
void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason="");
void acceptAuth(u16 peer_id, bool forSudoMode);
void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
bool getClientConInfo(u16 peer_id, con::rtt_stat_type type,float* retval);
bool getClientConInfo(u16 peer_id, con::rtt_stat_type type, float* retval);
bool getClientInfo(u16 peer_id,ClientState* state, u32* uptime,
u8* ser_vers, u16* prot_vers, u8* major, u8* minor, u8* patch,
std::string* vers_string);
@ -506,7 +506,7 @@ private:
ServerEnvironment *m_env = nullptr;
// server connection
con::Connection m_con;
std::shared_ptr<con::Connection> m_con;
// Ban checking
BanManager *m_banmanager = nullptr;