summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-08-09 02:17:43 +0200
committerHaru <haru@dotalux.com>2015-08-15 00:51:41 +0200
commitf8edb93a6a26cd81eeaad0eac23e33da7740c8b4 (patch)
treee1d6ef1a867613be7d8d0384c93c9767867a91a3 /src/map
parentb0210e25675b0b3e950a0ee13ae8652360d84386 (diff)
downloadhercules-f8edb93a6a26cd81eeaad0eac23e33da7740c8b4.tar.gz
hercules-f8edb93a6a26cd81eeaad0eac23e33da7740c8b4.tar.bz2
hercules-f8edb93a6a26cd81eeaad0eac23e33da7740c8b4.tar.xz
hercules-f8edb93a6a26cd81eeaad0eac23e33da7740c8b4.zip
Moved session array into the socket interface
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/chrif.c32
-rw-r--r--src/map/clif.c22
-rw-r--r--src/map/intif.c6
-rw-r--r--src/map/irc-bot.c6
-rw-r--r--src/map/pc.c4
-rw-r--r--src/map/script.c6
7 files changed, 39 insertions, 39 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b84546054..6c5a6282e 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -83,7 +83,7 @@ const char* atcommand_msgsd(struct map_session_data *sd, int msg_number) {
}
const char* atcommand_msgfd(int fd, int msg_number) {
- struct map_session_data *sd = sockt->session_is_valid(fd) ? session[fd]->session_data : NULL;
+ struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : NULL;
if( !(msg_number >= 0 && msg_number < MAX_MSG) )
return "??";
if( !sd || sd->lang_id >= atcommand->max_message_table || !atcommand->msg_table[sd->lang_id][msg_number] )
diff --git a/src/map/chrif.c b/src/map/chrif.c
index f9b6af7f7..62df026da 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -124,8 +124,8 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) {
if ( (node = chrif->auth_check(account_id, char_id, state) ) ) {
int fd = node->sd ? node->sd->fd : node->fd;
- if ( session[fd] && session[fd]->session_data == node->sd )
- session[fd]->session_data = NULL;
+ if ( sockt->session[fd] && sockt->session[fd]->session_data == node->sd )
+ sockt->session[fd]->session_data = NULL;
if ( node->sd ) {
if( node->sd->regs.vars )
@@ -177,8 +177,8 @@ bool chrif_auth_logout(TBL_PC* sd, enum sd_state state)
{
if(sd->fd && state == ST_LOGOUT) { //Disassociate player, and free it after saving ack returns. [Skotlex]
//fd info must not be lost for ST_MAPCHANGE as a final packet needs to be sent to the player.
- if ( session[sd->fd] )
- session[sd->fd]->session_data = NULL;
+ if ( sockt->session[sd->fd] )
+ sockt->session[sd->fd]->session_data = NULL;
sd->fd = 0;
}
@@ -238,7 +238,7 @@ void chrif_setport(uint16 port) {
// says whether the char-server is connected or not
int chrif_isconnected(void) {
- return (chrif->fd > 0 && session[chrif->fd] != NULL && chrif->state == 2);
+ return (chrif->fd > 0 && sockt->session[chrif->fd] != NULL && chrif->state == 2);
}
/*==========================================
@@ -384,7 +384,7 @@ bool chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port)
WFIFOL(chrif->fd,24) = htonl(ip);
WFIFOW(chrif->fd,28) = htons(port);
WFIFOB(chrif->fd,30) = sd->status.sex;
- WFIFOL(chrif->fd,31) = htonl(session[sd->fd]->client_addr);
+ WFIFOL(chrif->fd,31) = htonl(sockt->session[sd->fd]->client_addr);
WFIFOL(chrif->fd,35) = sd->group_id;
WFIFOSET(chrif->fd,39);
@@ -552,7 +552,7 @@ void chrif_authreq(struct map_session_data *sd, bool hstandalone) {
WFIFOL(chrif->fd,6) = sd->status.char_id;
WFIFOL(chrif->fd,10) = sd->login_id1;
WFIFOB(chrif->fd,14) = sd->status.sex;
- WFIFOL(chrif->fd,15) = htonl(session[sd->fd]->client_addr);
+ WFIFOL(chrif->fd,15) = htonl(sockt->session[sd->fd]->client_addr);
WFIFOB(chrif->fd,19) = hstandalone ? 1 : 0;
WFIFOSET(chrif->fd,20);
chrif->sd_to_auth(sd, ST_LOGIN);
@@ -1308,7 +1308,7 @@ void chrif_keepalive(int fd) {
WFIFOSET(fd,2);
}
void chrif_keepalive_ack(int fd) {
- session[fd]->flag.ping = 0;/* reset ping state, we received a packet */
+ sockt->session[fd]->flag.ping = 0;/* reset ping state, we received a packet */
}
void chrif_skillid2idx(int fd) {
int i, count = 0;
@@ -1344,18 +1344,18 @@ int chrif_parse(int fd) {
return 0;
}
- if ( session[fd]->flag.eof ) {
+ if ( sockt->session[fd]->flag.eof ) {
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 */
+ } else if ( sockt->session[fd]->flag.ping ) {/* we've reached stall time */
+ if( DIFF_TICK(sockt->last_tick, sockt->session[fd]->rdata_tick) > (sockt->stall_time * 2) ) {/* we can't wait any longer */
sockt->eof(fd);
return 0;
- } else if( session[fd]->flag.ping != 2 ) { /* we haven't sent ping out yet */
+ } else if( sockt->session[fd]->flag.ping != 2 ) { /* we haven't sent ping out yet */
chrif->keepalive(fd);
- session[fd]->flag.ping = 2;
+ sockt->session[fd]->flag.ping = 2;
}
}
@@ -1475,7 +1475,7 @@ bool send_users_tochar(void) {
*------------------------------------------*/
int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) {
static int displayed = 0;
- if ( chrif->fd <= 0 || session[chrif->fd] == NULL ) {
+ if ( chrif->fd <= 0 || sockt->session[chrif->fd] == NULL ) {
if ( !displayed ) {
ShowStatus("Attempting to connect to Char Server. Please wait.\n");
displayed = 1;
@@ -1486,8 +1486,8 @@ int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) {
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;
+ sockt->session[chrif->fd]->func_parse = chrif->parse;
+ sockt->session[chrif->fd]->flag.server = 1;
sockt->realloc_fifo(chrif->fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
chrif->connect(chrif->fd);
diff --git a/src/map/clif.c b/src/map/clif.c
index db5259d81..0784326c9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -291,7 +291,7 @@ int clif_send_sub(struct block_list *bl, va_list ap) {
nullpo_ret(sd = (struct map_session_data *)bl);
fd = sd->fd;
- if (!fd || session[fd] == NULL) //Don't send to disconnected clients.
+ if (!fd || sockt->session[fd] == NULL) //Don't send to disconnected clients.
return 0;
buf = va_arg(ap,void*);
@@ -427,7 +427,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target
for(i = 0; i < cd->users; i++) {
if (type == CHAT_WOS && cd->usersd[i] == sd)
continue;
- if ((fd=cd->usersd[i]->fd) >0 && session[fd]) { // Added check to see if session exists [PoW]
+ if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { // Added check to see if session exists [PoW]
WFIFOHEAD(fd,len);
memcpy(WFIFOP(fd,0), buf, len);
WFIFOSET(fd,len);
@@ -690,7 +690,7 @@ void clif_authrefuse(int fd, uint8 error_code)
// TODO: type enum
void clif_authfail_fd(int fd, int type)
{
- if (!fd || !session[fd] || session[fd]->func_parse != clif->parse) //clif_authfail should only be invoked on players!
+ if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) //clif_authfail should only be invoked on players!
return;
WFIFOHEAD(fd, packet_len(0x81));
@@ -1710,7 +1710,7 @@ void clif_quitsave(int fd,struct map_session_data *sd) {
else if (sd->fd) {
//Disassociate session from player (session is deleted after this function was called)
//And set a timer to make him quit later.
- session[sd->fd]->session_data = NULL;
+ sockt->session[sd->fd]->session_data = NULL;
sd->fd = 0;
timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0);
}
@@ -5682,7 +5682,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, size_t mes_len)
/// 2 = ignored by target
/// 3 = everyone ignored by target
void clif_wis_end(int fd, int flag) {
- struct map_session_data *sd = sockt->session_is_valid(fd) ? session[fd]->session_data : NULL;
+ struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : NULL;
struct packet_wis_end p;
if( !sd )
@@ -8975,7 +8975,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
* clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF;
sd->parse_cmd_func = clif->parse_cmd;
- session[fd]->session_data = sd;
+ sockt->session[fd]->session_data = sd;
pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd);
@@ -9980,7 +9980,7 @@ void clif_parse_Restart(int fd, struct map_session_data *sd) {
&& (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout)
) {
//Send to char-server for character selection.
- chrif->charselectreq(sd, session[fd]->client_addr);
+ chrif->charselectreq(sd, sockt->session[fd]->client_addr);
} else {
clif->disconnect_ack(sd, 1);
}
@@ -18296,13 +18296,13 @@ int clif_parse(int fd) {
unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd);
// begin main client packet processing loop
- sd = (TBL_PC *)session[fd]->session_data;
+ sd = (TBL_PC *)sockt->session[fd]->session_data;
- if (session[fd]->flag.eof) {
+ if (sockt->session[fd]->flag.eof) {
if (sd) {
if (sd->state.autotrade) {
//Disassociate character from the socket connection.
- session[fd]->session_data = NULL;
+ sockt->session[fd]->session_data = NULL;
sd->fd = 0;
ShowInfo("Character '"CL_WHITE"%s"CL_RESET"' logged off (using @autotrade).\n", sd->status.name);
} else
@@ -18316,7 +18316,7 @@ int clif_parse(int fd) {
map->quit(sd);
}
} else {
- ShowInfo("Closed connection from '"CL_WHITE"%s"CL_RESET"'.\n", sockt->ip2str(session[fd]->client_addr, NULL));
+ ShowInfo("Closed connection from '"CL_WHITE"%s"CL_RESET"'.\n", sockt->ip2str(sockt->session[fd]->client_addr, NULL));
}
sockt->close(fd);
return 0;
diff --git a/src/map/intif.c b/src/map/intif.c
index 26fd1949c..a2e19f9e9 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -45,7 +45,7 @@ struct intif_interface intif_s;
int CheckForCharServer(void)
{
- return ((chrif->fd <= 0) || session[chrif->fd] == NULL || session[chrif->fd]->wdata == NULL);
+ return ((chrif->fd <= 0) || sockt->session[chrif->fd] == NULL || sockt->session[chrif->fd]->wdata == NULL);
}
// pet
@@ -2145,9 +2145,9 @@ void intif_request_accinfo( int u_fd, int aid, int group_lv, char* query ) {
void intif_parse_MessageToFD(int fd) {
int u_fd = RFIFOL(fd,4);
- if( session[u_fd] && session[u_fd]->session_data ) {
+ if( sockt->session[u_fd] && sockt->session[u_fd]->session_data ) {
int aid = RFIFOL(fd,8);
- struct map_session_data * sd = session[u_fd]->session_data;
+ struct map_session_data * sd = sockt->session[u_fd]->session_data;
/* matching e.g. previous fd owner didn't dc during request or is still the same */
if( sd && sd->bl.id == aid ) {
char msg[512];
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index 451d224fd..34069f74f 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -42,8 +42,8 @@ int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) {
ircbot->last_try = timer->gettick();
if ((ircbot->fd = sockt->make_connection(ircbot->ip, channel->config->irc_server_port, &opt)) > 0) {
- session[ircbot->fd]->func_parse = ircbot->parse;
- session[ircbot->fd]->flag.server = 1;
+ sockt->session[ircbot->fd]->func_parse = ircbot->parse;
+ sockt->session[ircbot->fd]->flag.server = 1;
timer->add(timer->gettick() + 3000, ircbot->identify_timer, 0, 0);
ircbot->isOn = true;
}
@@ -114,7 +114,7 @@ struct irc_func* irc_func_search(char* function_name) {
int irc_parse(int fd) {
char *parse_string = NULL, *str_safe = NULL;
- if (session[fd]->flag.eof) {
+ if (sockt->session[fd]->flag.eof) {
sockt->close(fd);
ircbot->fd = 0;
ircbot->isOn = false;
diff --git a/src/map/pc.c b/src/map/pc.c
index 327b7428f..d7b7a9f48 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -45,7 +45,7 @@
#include "common/nullpo.h"
#include "common/random.h"
#include "common/showmsg.h"
-#include "common/socket.h" // session[]
+#include "common/socket.h"
#include "common/strlib.h" // safestrncpy()
#include "common/sysinfo.h"
#include "common/timer.h"
@@ -1007,7 +1007,7 @@ int pc_isequip(struct map_session_data *sd,int n)
bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers) {
int i;
int64 tick = timer->gettick();
- uint32 ip = session[sd->fd]->client_addr;
+ uint32 ip = sockt->session[sd->fd]->client_addr;
sd->login_id2 = login_id2;
diff --git a/src/map/script.c b/src/map/script.c
index 837f83668..4fb196255 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -18265,21 +18265,21 @@ BUILDIN(getcharip) {
}
/* check for sd and IP */
- if (!sd || !session[sd->fd]->client_addr)
+ if (!sd || !sockt->session[sd->fd]->client_addr)
{
script_pushconststr(st, "");
return true;
}
/* return the client ip_addr converted for output */
- if (sd && sd->fd && session[sd->fd])
+ if (sd && sd->fd && sockt->session[sd->fd])
{
/* initiliaze */
const char *ip_addr = NULL;
uint32 ip;
/* set ip, ip_addr and convert to ip and push str */
- ip = session[sd->fd]->client_addr;
+ ip = sockt->session[sd->fd]->client_addr;
ip_addr = sockt->ip2str(ip, NULL);
script_pushstrcopy(st, ip_addr);
}