diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-21 10:55:26 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-21 10:55:26 +0000 |
commit | bc03dcf3609194073da5fdf8e2e267a90f64cc48 (patch) | |
tree | e77c36250e9986b6b939bd875a0772db89d05df6 /src/char | |
parent | 3c585c70f62a60068cca56be027a4f02b958a787 (diff) | |
download | hercules-bc03dcf3609194073da5fdf8e2e267a90f64cc48.tar.gz hercules-bc03dcf3609194073da5fdf8e2e267a90f64cc48.tar.bz2 hercules-bc03dcf3609194073da5fdf8e2e267a90f64cc48.tar.xz hercules-bc03dcf3609194073da5fdf8e2e267a90f64cc48.zip |
* [Added]:
- DNS (WAN) sync for those pesky disconnections (dynamic ip renewal).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7275 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c index 527a68ac6..e0e6415fb 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -75,6 +75,7 @@ char backup_txt_flag = 0; // The backup_txt file was created because char deleti char unknown_char_name[1024] = "Unknown";
char char_log_filename[1024] = "log/char.log";
char db_path[1024]="db";
+char *char_server_dns = NULL;
// Advanced subnet check [LuzZza]
struct _subnet {
@@ -1797,6 +1798,7 @@ static int char_delete(struct mmo_charstatus *cs) { int parse_tologin(int fd) {
int i;
struct char_session_data *sd;
+ struct hostent *h;
RFIFOHEAD(fd);
// only login-server can have an access to here.
@@ -2293,6 +2295,25 @@ int parse_tologin(int fd) { RFIFOSKIP(fd,6);
}
break;
+ case 0x2735:
+ ShowInfo("IP Sync in progress...\n");
+ h = char_server_dns?gethostbyname(char_server_dns):NULL;
+ if(h){
+ WFIFOW(fd,0) = 0x2736;
+ WFIFOB(fd,2) = h->h_addr[0];
+ WFIFOB(fd,3) = h->h_addr[1];
+ WFIFOB(fd,4) = h->h_addr[2];
+ WFIFOB(fd,5) = h->h_addr[3];
+ WFIFOSET(fd, 6);
+ }
+ for(i = 0; i < MAX_MAP_SERVERS; i++){
+ if(server_fd[i] >= 0){
+ WFIFOW(server_fd[i], 0) = 0x2b1e;
+ WFIFOSET(server_fd[i], 2);
+ }
+ }
+ RFIFOSKIP(fd,2);
+ break;
default:
ShowWarning("Unknown packet 0x%04x received from login-server, disconnecting.\n", RFIFOW(fd,0));
session[fd]->eof = 1;
@@ -3055,6 +3076,15 @@ int parse_frommap(int fd) { RFIFOSKIP(fd, RFIFOW(fd, 2));
break;
}
+ case 0x2736:
+ for(i = 0; i < MAX_MAP_SERVERS; i++){
+ if(server_fd[i] == fd){
+ ShowInfo("IP Sync (Server #%d) successful.\n",i);
+ server[i].ip = RFIFOL(fd, 2);
+ }
+ }
+ RFIFOSKIP(fd,6);
+ break;
default:
// inter serverɓn
{
@@ -3967,6 +3997,10 @@ int char_config_read(const char *cfgName) { } else if (strcmpi(w1, "login_ip") == 0) {
login_ip_set_ = 1;
h = gethostbyname(w2);
+ if(char_server_dns)
+ aFree(char_server_dns);
+ char_server_dns = (char *)aCalloc(strlen(w2)+1, 1);
+ strcpy(char_server_dns, w2);
if (h != NULL) {
ShowStatus("Login server IP address : %s -> %d.%d.%d.%d\n", w2, (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
sprintf(login_ip_str, "%d.%d.%d.%d", (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
@@ -4137,6 +4171,7 @@ void do_final(void) { if(gm_account) aFree(gm_account);
if(char_dat) aFree(char_dat);
+ if(char_server_dns) aFree(char_server_dns);
delete_session(login_fd);
delete_session(char_fd);
|