From 88d6058674db089432f9034baa08a30253d4dc73 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Mar 2015 13:39:13 +0300 Subject: char: add code for reset timeout timer if receive ping packet. But disabled for now. --- src/char/char.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/char/char.c') diff --git a/src/char/char.c b/src/char/char.c index d68d02b..f971617 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -10,6 +10,7 @@ #include "../../../common/mmo.h" #include "../../../common/socket.h" #include "../../../common/strlib.h" +#include "../../../common/timer.h" #include "../../../char/char.h" #include "common/ip.h" @@ -130,3 +131,29 @@ void echar_creation_failed(int *fdPtr, int *result) WFIFOSET(fd,3); hookStop(); } + +void echar_parse_char_ping(int *fdPtr) +{ + const int fd = *fdPtr; + RFIFOSKIP(fd, 6); + + struct char_session_data* sd = (struct char_session_data*)session[fd]->session_data; + if (!sd) + { + hookStop(); + return; + } + struct online_char_data* character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id); + if (!character) + { + hookStop(); + return; + } + + if (character->waiting_disconnect != INVALID_TIMER) + { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = timer->add(timer->gettick() + 30000, chr->waiting_disconnect, character->account_id, 0); + } + hookStop(); +} -- cgit v1.2.3-70-g09d2