Skip to content

Commit

Permalink
Merge pull request #3264 from guilherme-gm/warns-interserver
Browse files Browse the repository at this point in the history
Add more details when char-server fails to connect
  • Loading branch information
MishimaHaruna authored Dec 28, 2023
2 parents c668f88 + 9fbd1b6 commit 7e6c906
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/char/char.c
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ static int char_parse_fromlogin_connection_state(int fd)
case 1: // Invalid username/password
ShowError("Can not connect to login-server.\n");
ShowError("The server communication passwords (default s1/p1) are probably invalid.\n");
ShowError("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n");
ShowError("Also, please make sure your login db has the correct communication username/passwords, the gender of the account is S and its id is between 0 and (MAX_SERVERS - 1).\n");
ShowError("The communication passwords are set in /conf/map/map-server.conf and /conf/char/char-server.conf\n");
sockt->eof(fd);
return 1;
Expand Down Expand Up @@ -6096,7 +6096,7 @@ static void char_ensure_online_char_data(struct online_char_data *character)
{
nullpo_retv(character);
if (character->data == NULL) {
character->data = aCalloc(sizeof(struct online_char_data2), 1);
character->data = aCalloc(1, sizeof(struct online_char_data2));
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/login/login.c
Original file line number Diff line number Diff line change
Expand Up @@ -1504,11 +1504,14 @@ static void login_parse_request_connection(int fd, struct login_session_data* sd
if (!sockt->allowed_ip_check(ipl)) {
ShowNotice("Connection of the char-server '%s' REFUSED (IP not allowed).\n", server_name);
login->char_server_connection_status(fd, sd, 2);
} else if (sd->sex != 'S') {
ShowNotice("Connection of the char-server '%s' REFUSED (Account sex must be 'S').\n", server_name);
login->char_server_connection_status(fd, sd, 1);
} else if (sd->account_id < 0 || sd->account_id >= ARRAYLENGTH(login->dbs->server)) {
ShowNotice("Connection of the char-server '%s' REFUSED (Account ID must be between 0 and %d).\n", server_name, ARRAYLENGTH(login->dbs->server) - 1);
login->char_server_connection_status(fd, sd, 1);
} else if (core->runflag == LOGINSERVER_ST_RUNNING &&
result == -1 &&
sd->sex == 'S' &&
sd->account_id >= 0 &&
sd->account_id < ARRAYLENGTH(login->dbs->server) &&
!sockt->session_is_valid(login->dbs->server[sd->account_id].fd))
{
ShowStatus("Connection of the char-server '%s' accepted.\n", server_name);
Expand Down

0 comments on commit 7e6c906

Please sign in to comment.