From 3b50b2766aeb09c9fc0ad0ea07426bb2187df3d7 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 17 Jul 2015 16:40:41 +0200 Subject: Optional reconnect functionality Enable the server to request the client to reconnect. This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting. --- src/server.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/server.h') diff --git a/src/server.h b/src/server.h index fbca05f26..5f3905005 100644 --- a/src/server.h +++ b/src/server.h @@ -244,8 +244,13 @@ public: { return m_shutdown_requested; } // request server to shutdown - inline void requestShutdown(void) - { m_shutdown_requested = true; } + inline void requestShutdown() { m_shutdown_requested = true; } + void requestShutdown(const std::string &msg, bool reconnect) + { + m_shutdown_requested = true; + m_shutdown_msg = msg; + m_shutdown_ask_reconnect = reconnect; + } // Returns -1 if failed, sound handle on success // Envlock @@ -366,6 +371,8 @@ public: void deletingPeer(con::Peer *peer, bool timeout); void DenySudoAccess(u16 peer_id); + void DenyAccessVerCompliant(u16 peer_id, u16 proto_ver, AccessDeniedCode reason, + const std::string &str_reason = "", bool reconnect = false); 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); @@ -390,7 +397,8 @@ private: void SendMovement(u16 peer_id); void SendHP(u16 peer_id, u8 hp); void SendBreath(u16 peer_id, u16 breath); - void SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason); + void SendAccessDenied(u16 peer_id, AccessDeniedCode reason, + const std::string &custom_reason, bool reconnect = false); void SendAccessDenied_Legacy(u16 peer_id, const std::wstring &reason); void SendDeathscreen(u16 peer_id,bool set_camera_point_target, v3f camera_point_target); void SendItemDef(u16 peer_id,IItemDefManager *itemdef, u16 protocol_version); @@ -490,7 +498,7 @@ private: Call with env and con locked. */ - PlayerSAO *emergePlayer(const char *name, u16 peer_id); + PlayerSAO *emergePlayer(const char *name, u16 peer_id, u16 proto_version); void handlePeerChanges(); @@ -596,6 +604,8 @@ private: */ bool m_shutdown_requested; + std::string m_shutdown_msg; + bool m_shutdown_ask_reconnect; /* Map edit event queue. Automatically receives all map edits. -- cgit v1.2.3