diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-22 13:39:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-22 13:39:13 +0300 |
commit | 88d6058674db089432f9034baa08a30253d4dc73 (patch) | |
tree | c1fddae8be1363896f41a486cafcd04977ec9cea /src/char/char.c | |
parent | c89fd6fc22564b9d7ea491f2868453bf81b8c0cb (diff) | |
download | evol-hercules-88d6058674db089432f9034baa08a30253d4dc73.tar.gz evol-hercules-88d6058674db089432f9034baa08a30253d4dc73.tar.bz2 evol-hercules-88d6058674db089432f9034baa08a30253d4dc73.tar.xz evol-hercules-88d6058674db089432f9034baa08a30253d4dc73.zip |
char: add code for reset timeout timer if receive ping packet. But disabled for now.
Diffstat (limited to 'src/char/char.c')
-rw-r--r-- | src/char/char.c | 27 |
1 files changed, 27 insertions, 0 deletions
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(); +} |