mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
Move network protocol implementation behind an interface
This commit is contained in:
parent
c6ef5ab259
commit
7968ab6928
18 changed files with 2109 additions and 2054 deletions
|
@ -392,8 +392,7 @@ void Client::connect(const Address &address, const std::string &address_name,
|
|||
}
|
||||
|
||||
m_address_name = address_name;
|
||||
m_con.reset(new con::Connection(PROTOCOL_ID, 512, CONNECTION_TIMEOUT,
|
||||
address.isIPv6(), this));
|
||||
m_con.reset(con::createMTP(CONNECTION_TIMEOUT, address.isIPv6(), this));
|
||||
|
||||
infostream << "Connecting to server at ";
|
||||
address.print(infostream);
|
||||
|
@ -866,13 +865,13 @@ bool Client::loadMedia(const std::string &data, const std::string &filename,
|
|||
}
|
||||
|
||||
// Virtual methods from con::PeerHandler
|
||||
void Client::peerAdded(con::Peer *peer)
|
||||
void Client::peerAdded(con::IPeer *peer)
|
||||
{
|
||||
infostream << "Client::peerAdded(): peer->id="
|
||||
<< peer->id << std::endl;
|
||||
}
|
||||
|
||||
void Client::deletingPeer(con::Peer *peer, bool timeout)
|
||||
void Client::deletingPeer(con::IPeer *peer, bool timeout)
|
||||
{
|
||||
infostream << "Client::deletingPeer(): "
|
||||
"Server Peer is getting deleted "
|
||||
|
|
|
@ -71,7 +71,7 @@ class Camera;
|
|||
struct PlayerControl;
|
||||
class NetworkPacket;
|
||||
namespace con {
|
||||
class Connection;
|
||||
class IConnection;
|
||||
}
|
||||
using sound_handle_t = int;
|
||||
|
||||
|
@ -452,8 +452,8 @@ private:
|
|||
void loadMods();
|
||||
|
||||
// Virtual methods from con::PeerHandler
|
||||
void peerAdded(con::Peer *peer) override;
|
||||
void deletingPeer(con::Peer *peer, bool timeout) override;
|
||||
void peerAdded(con::IPeer *peer) override;
|
||||
void deletingPeer(con::IPeer *peer, bool timeout) override;
|
||||
|
||||
void initLocalMapSaving(const Address &address,
|
||||
const std::string &hostname,
|
||||
|
@ -493,7 +493,7 @@ private:
|
|||
std::unique_ptr<MeshUpdateManager> m_mesh_update_manager;
|
||||
ClientEnvironment m_env;
|
||||
std::unique_ptr<ParticleManager> m_particle_manager;
|
||||
std::unique_ptr<con::Connection> m_con;
|
||||
std::unique_ptr<con::IConnection> m_con;
|
||||
std::string m_address_name;
|
||||
ELoginRegister m_allow_login_or_register = ELoginRegister::Any;
|
||||
Camera *m_camera = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue