summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/socket.c')
-rw-r--r--src/common/socket.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index b522ac607..4f7afd8fd 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -647,6 +647,14 @@ int WFIFOSET(int fd, size_t len)
ShowFatalError("WFIFOSET: Packet 0x%x is too big. (len=%u, max=%u)\n", (*(uint16*)(s->wdata + s->wdata_size)), (unsigned int)len, 0xFFFF);
exit(EXIT_FAILURE);
}
+ else if( len == 0 )
+ {
+ // abuses the fact, that the code that did WFIFOHEAD(fd,0), already wrote
+ // the packet type into memory, even if it could have overwritten vital data
+ // this can happen when a new packet was added on map-server, but packet len table was not updated
+ ShowWarning("WFIFOSET: Attempted to send zero-length packet, most likely 0x%04x (please report this).\n", WFIFOW(fd,0));
+ return 0;
+ }
if( !s->flag.server && len > socket_max_client_packet )
{// see declaration of socket_max_client_packet for details
@@ -1222,6 +1230,7 @@ int socket_getips(uint32* ips, int max)
void socket_init(void)
{
char *SOCKET_CONF_FILENAME = "conf/packet_athena.conf";
+ unsigned int rlim_cur = FD_SETSIZE;
#ifdef WIN32
{// Start up windows networking
@@ -1265,6 +1274,7 @@ void socket_init(void)
if( err == EPERM )
errmsg = "permission denied";
ShowWarning("socket_init: failed to set socket limit to %d, setting to maximum allowed (original limit=%d, current limit=%d, maximum allowed=%d, error=%s).\n", FD_SETSIZE, rlim_ori, (int)rlp.rlim_cur, (int)rlp.rlim_max, errmsg);
+ rlim_cur = rlp.rlim_cur;
}
}
}
@@ -1294,6 +1304,8 @@ void socket_init(void)
add_timer_func_list(connect_check_clear, "connect_check_clear");
add_timer_interval(gettick()+1000, connect_check_clear, 0, 0, 5*60*1000);
#endif
+
+ ShowInfo("Server supports up to '"CL_WHITE"%u"CL_RESET"' concurrent connections.\n", rlim_cur);
}