summaryrefslogtreecommitdiff
path: root/src/map/chrif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r--src/map/chrif.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 5bd1e436f..f9b6af7f7 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -219,14 +219,14 @@ void chrif_checkdefaultlogin(void) {
bool chrif_setip(const char* ip) {
char ip_str[16];
- if ( !( chrif->ip = host2ip(ip) ) ) {
+ if (!(chrif->ip = sockt->host2ip(ip))) {
ShowWarning("Failed to Resolve Char Server Address! (%s)\n", ip);
return false;
}
safestrncpy(chrif->ip_str, ip, sizeof(chrif->ip_str));
- ShowInfo("Char Server IP Address : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%s"CL_RESET"'.\n", ip, ip2str(chrif->ip, ip_str));
+ ShowInfo("Char Server IP Address : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%s"CL_RESET"'.\n", ip, sockt->ip2str(chrif->ip, ip_str));
return true;
}
@@ -542,7 +542,7 @@ void chrif_authreq(struct map_session_data *sd, bool hstandalone) {
struct auth_node *node= chrif->search(sd->bl.id);
if( node != NULL || !chrif->isconnected() ) {
- set_eof(sd->fd);
+ sockt->eof(sd->fd);
return;
}
@@ -980,7 +980,7 @@ void chrif_idbanned(int fd) {
clif->message(sd->fd, tmpstr);
}
- set_eof(sd->fd); // forced to disconnect for the change
+ sockt->eof(sd->fd); // forced to disconnect for the change
map->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
}
@@ -1232,9 +1232,9 @@ bool chrif_char_offline_nsd(int account_id, int char_id) {
bool chrif_flush(void) {
chrif_check(false);
- set_nonblocking(chrif->fd, 0);
- flush_fifos();
- set_nonblocking(chrif->fd, 1);
+ sockt->set_nonblocking(chrif->fd, 0);
+ sockt->flush_fifos();
+ sockt->set_nonblocking(chrif->fd, 1);
return true;
}
@@ -1286,7 +1286,7 @@ void chrif_update_ip(int fd) {
WFIFOHEAD(fd,6);
- new_ip = host2ip(chrif->ip_str);
+ new_ip = sockt->host2ip(chrif->ip_str);
if (new_ip && new_ip != chrif->ip)
chrif->ip = new_ip; //Update chrif->ip
@@ -1315,7 +1315,7 @@ void chrif_skillid2idx(int fd) {
if( fd == 0 ) fd = chrif->fd;
- if( !session_isValid(fd) )
+ if (!sockt->session_is_valid(fd))
return;
WFIFOHEAD(fd,4 + (MAX_SKILL * 4));
@@ -1340,18 +1340,18 @@ int chrif_parse(int fd) {
// only process data from the char-server
if ( fd != chrif->fd ) {
ShowDebug("chrif_parse: Disconnecting invalid session #%d (is not the char-server)\n", fd);
- do_close(fd);
+ sockt->close(fd);
return 0;
}
if ( session[fd]->flag.eof ) {
- do_close(fd);
+ sockt->close(fd);
chrif->fd = -1;
chrif->on_disconnect();
return 0;
} else if ( session[fd]->flag.ping ) {/* we've reached stall time */
if( DIFF_TICK(sockt->last_tick, session[fd]->rdata_tick) > (sockt->stall_time * 2) ) {/* we can't wait any longer */
- set_eof(fd);
+ sockt->eof(fd);
return 0;
} else if( session[fd]->flag.ping != 2 ) { /* we haven't sent ping out yet */
chrif->keepalive(fd);
@@ -1377,7 +1377,7 @@ int chrif_parse(int fd) {
if (r == 2) return 0; // Didn't have enough data (len==-1)
ShowWarning("chrif_parse: session #%d, intif->parse failed (unrecognized command 0x%.4x).\n", fd, cmd);
- set_eof(fd);
+ sockt->eof(fd);
return 0;
}
@@ -1418,7 +1418,7 @@ int chrif_parse(int fd) {
case 0x2b27: chrif->authfail(fd); break;
default:
ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, cmd);
- set_eof(fd);
+ sockt->eof(fd);
return 0;
}
if ( fd == chrif->fd ) //There's the slight chance we lost the connection during parse, in which case this would segfault if not checked [Skotlex]
@@ -1483,12 +1483,12 @@ int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) {
chrif->state = 0;
- if ( ( chrif->fd = make_connection(chrif->ip, chrif->port,NULL) ) == -1) //Attempt to connect later. [Skotlex]
+ if ((chrif->fd = sockt->make_connection(chrif->ip, chrif->port,NULL)) == -1) //Attempt to connect later. [Skotlex]
return 0;
session[chrif->fd]->func_parse = chrif->parse;
session[chrif->fd]->flag.server = 1;
- realloc_fifo(chrif->fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
+ sockt->realloc_fifo(chrif->fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
chrif->connect(chrif->fd);
chrif->connected = (chrif->state == 2);
@@ -1529,7 +1529,7 @@ void chrif_send_report(char* buf, int len) {
WFIFOSET(chrif->fd,len + 2);
- flush_fifo(chrif->fd); /* ensure it's sent now. */
+ sockt->flush(chrif->fd); /* ensure it's sent now. */
}
#endif
}
@@ -1601,7 +1601,7 @@ int auth_db_final(DBKey key, DBData *data, va_list ap) {
void do_final_chrif(void)
{
if( chrif->fd != -1 ) {
- do_close(chrif->fd);
+ sockt->close(chrif->fd);
chrif->fd = -1;
}