summaryrefslogtreecommitdiff
path: root/src/login/login.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/login/login.cpp')
-rw-r--r--src/login/login.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 966d7dc..a60b34e 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -257,28 +257,27 @@ void login_log(XString line)
}
static
-void on_delete(Session *sess)
+void delete_login(Session *sess)
+{
+ (void)sess;
+}
+
+static
+void delete_fromchar(Session *sess)
{
auto it = std::find(server_session.begin(), server_session.end(), sess);
+ assert (it != server_session.end());
+ int id = it - server_session.begin();
IP4Address ip = sess->client_ip;
- if (it != server_session.end())
- {
- int id = it - server_session.begin();
- PRINTF("Char-server '%s' has disconnected.\n", server[id].name);
- LOGIN_LOG("Char-server '%s' has disconnected (ip: %s).\n",
- server[id].name, ip);
- server_session[id] = nullptr;
- server[id] = mmo_char_server{};
- }
- else
- {
- // player session
- ;
- }
+ PRINTF("Char-server '%s' has disconnected.\n", server[id].name);
+ LOGIN_LOG("Char-server '%s' has disconnected (ip: %s).\n",
+ server[id].name, ip);
+ server_session[id] = nullptr;
+ server[id] = mmo_char_server{};
}
static
-void on_delete_admin(Session *s)
+void delete_admin(Session *s)
{
PRINTF("Remote administration has disconnected (session #%d).\n",
s);
@@ -3015,7 +3014,7 @@ void parse_login(Session *s)
WFIFOW(s, 0) = 0x2711;
WFIFOB(s, 2) = 0;
WFIFOSET(s, 3);
- s->func_parse = parse_fromchar;
+ s->set_parsers(SessionParsers{func_parse: parse_fromchar, func_delete: delete_fromchar});
realloc_fifo(s, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
// send GM account to char-server
len = 4;
@@ -3089,8 +3088,7 @@ void parse_login(Session *s)
password, ip);
PRINTF("Connection of a remote administration accepted (non encrypted password).\n");
WFIFOB(s, 2) = 0;
- s->func_parse = parse_admin;
- s->func_delete = on_delete_admin;
+ s->set_parsers(SessionParsers{func_parse: parse_admin, func_delete: delete_admin});
}
else if (admin_state != 1)
LOGIN_LOG("'ladmin'-login: Connection in administration mode REFUSED - remote administration is disabled (non encrypted password: %s, ip: %s)\n",
@@ -3912,8 +3910,7 @@ int do_init(Slice<ZString> argv)
read_gm_account();
mmo_auth_init();
// set_termfunc (mmo_auth_sync);
- set_defaultparse(parse_login, on_delete);
- login_session = make_listen_port(login_port);
+ login_session = make_listen_port(login_port, SessionParsers{func_parse: parse_login, func_delete: delete_login});
Timer(gettick() + std::chrono::minutes(5),