summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorhemagx <hemagx2@gmail.com>2016-04-12 15:24:30 +0200
committerHaru <haru@dotalux.com>2016-04-16 07:38:46 +0200
commitc7653654a4429751bf36e19f2529fd4c1303d636 (patch)
tree3948d2adb14c9fdf222ce155fb8352f6f904bb68 /src/login
parentd60ef91d8355f117c1ad5209b3f43647b9656892 (diff)
downloadhercules-c7653654a4429751bf36e19f2529fd4c1303d636.tar.gz
hercules-c7653654a4429751bf36e19f2529fd4c1303d636.tar.bz2
hercules-c7653654a4429751bf36e19f2529fd4c1303d636.tar.xz
hercules-c7653654a4429751bf36e19f2529fd4c1303d636.zip
Rewrite client interface for login server (part 4)
Changed login server packet processing so that no more than 3 packets are processed at once (same as the map server's clif processing) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/login')
-rw-r--r--src/login/login.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/login/login.c b/src/login/login.c
index bbd16abab..f0a51103f 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -48,6 +48,9 @@ struct login_interface *login;
struct Login_Config login_config_;
struct mmo_char_server server[MAX_SERVERS]; // char server data
+/// Maximum amount of packets processed at once from the same client
+#define MAX_PROCESSED_PACKETS (3)
+
// Packet DB
#define MIN_PACKET_DB 0x0064
#define MAX_PACKET_DB 0x08ff
@@ -1821,8 +1824,8 @@ bool login_client_login(int fd, struct login_session_data *sd)
return false;
}
-void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2)));
-void login_send_coding_key(int fd, struct login_session_data* sd)
+void login_send_coding_key(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
+void login_send_coding_key(int fd, struct login_session_data *sd)
{
struct packet_AC_ACK_HASH *packet = NULL;
int16 size = sizeof(*packet) + sd->md5keylen;
@@ -1951,6 +1954,7 @@ enum parsefunc_rcode login_parse_packet(const struct login_packet_db *lpd, int f
int login_parse_login(int fd)
{
struct login_session_data *sd = NULL;
+ int i;
char ip[16];
uint32 ipl = sockt->session[fd]->client_addr;
sockt->ip2str(ipl, ip);
@@ -1977,7 +1981,7 @@ int login_parse_login(int fd)
sd->fd = fd;
}
- while (RFIFOREST(fd) >= 2) {
+ for (i = 0; i < MAX_PROCESSED_PACKETS; ++i) {
enum parsefunc_rcode result;
int16 packet_id = RFIFOW(fd, 0);
int packet_len = (int)RFIFOREST(fd);