summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-08 16:36:48 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-08 16:36:48 +0000
commit4e8674860d894a1b1b9cbf6b7a7e19e7533ff29c (patch)
treec168183b6680bc10ca02a412f629bceabd7cd3cb /src/common
parent84087a82d95c4b6810fed0b4f4f8312523367a93 (diff)
downloadhercules-4e8674860d894a1b1b9cbf6b7a7e19e7533ff29c.tar.gz
hercules-4e8674860d894a1b1b9cbf6b7a7e19e7533ff29c.tar.bz2
hercules-4e8674860d894a1b1b9cbf6b7a7e19e7533ff29c.tar.xz
hercules-4e8674860d894a1b1b9cbf6b7a7e19e7533ff29c.zip
- Fixed the new socket code, which was triggering the inactivity timeout on the servers' listening sockets
- Fixed the TURBO code not working since r4468 (parse func never called) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9826 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/core.c2
-rw-r--r--src/common/socket.c5
-rw-r--r--src/common/socket.h4
3 files changed, 5 insertions, 6 deletions
diff --git a/src/common/core.c b/src/common/core.c
index f0ab846d1..94d7272ad 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -264,9 +264,7 @@ int main (int argc, char **argv)
while (runflag) {
next = do_timer(gettick_nocache());
do_sendrecv(next);
- #ifndef TURBO
do_parsepacket();
- #endif
}
}
diff --git a/src/common/socket.c b/src/common/socket.c
index 2a6011a22..43422da85 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -133,7 +133,7 @@ void set_nonblocking(int fd, int yes)
{
// TCP_NODELAY BOOL Disables the Nagle algorithm for send coalescing.
if(mode_neg)
- setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,(char *)&yes, sizeof yes);
+ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&yes, sizeof yes);
// FIONBIO Use with a nonzero argp parameter to enable the nonblocking mode of socket s.
// The argp parameter is zero if nonblocking is to be disabled.
@@ -291,6 +291,7 @@ int connect_client(int listen_fd)
create_session(fd, recv_to_fifo, send_from_fifo, default_func_parse);
session[fd]->client_addr = client_address;
+ session[fd]->rdata_tick = last_tick;
return fd;
}
@@ -380,6 +381,7 @@ int make_connection(long ip, int port)
FD_SET(fd,&readfds);
create_session(fd, recv_to_fifo, send_from_fifo, default_func_parse);
+ session[fd]->rdata_tick = last_tick;
return fd;
}
@@ -394,7 +396,6 @@ int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseFunc fun
session[fd]->func_recv = func_recv;
session[fd]->func_send = func_send;
session[fd]->func_parse = func_parse;
- session[fd]->rdata_tick = last_tick;
return 0;
}
diff --git a/src/common/socket.h b/src/common/socket.h
index dc156318c..1c4a1bd8c 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -81,8 +81,8 @@ struct socket_data {
size_t max_rdata, max_wdata;
size_t rdata_size, wdata_size;
size_t rdata_pos;
- time_t rdata_tick;
- struct sockaddr_in client_addr;
+ time_t rdata_tick; // time of last receive (for detecting timeouts)
+ struct sockaddr_in client_addr; // remote client address (zero for s2s connections)
void* session_data;
RecvFunc func_recv;
SendFunc func_send;