aboutsummaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-07-17 16:40:41 +0200
committerest31 <MTest31@outlook.com>2015-07-23 07:38:13 +0200
commit3b50b2766aeb09c9fc0ad0ea07426bb2187df3d7 (patch)
tree5ae54f8dcfc2b496a4937dc8ccf524d7c99f4e23 /src/server.h
parent1e0e85f82e030e761c36ba5a12427bec0fb4e4f2 (diff)
downloadminetest-3b50b2766aeb09c9fc0ad0ea07426bb2187df3d7.tar.gz
minetest-3b50b2766aeb09c9fc0ad0ea07426bb2187df3d7.tar.bz2
minetest-3b50b2766aeb09c9fc0ad0ea07426bb2187df3d7.zip
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.
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h18
1 files changed, 14 insertions, 4 deletions
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.