diff --git a/include/fdlist.h b/include/fdlist.h index 0d0fea1d2..6bb03188d 100644 --- a/include/fdlist.h +++ b/include/fdlist.h @@ -32,18 +32,6 @@ extern int fd_fileopen(const char *path, unsigned int flags); #define FD_SELECT_READ 0x1 #define FD_SELECT_WRITE 0x2 -/* Socket buffer sizes for clients and servers - * Note that these have been carefully chosen so you shouldn't touch these. - * If you make these much higher then be aware that this means you loose - * send queue / receive queue protection, otherwise known as "Excess flood" - * and "SendQ Exceeded", since these queues are ON TOP of UnrealIRCd's - * own queueing mechanism, it uses the OS TCP Socket queue. - */ -#define USER_SOCKET_RECEIVE_BUFFER 8192 -#define USER_SOCKET_SEND_BUFFER 32768 -#define SERVER_SOCKET_RECEIVE_BUFFER 131072 -#define SERVER_SOCKET_SEND_BUFFER 131072 - extern void fd_setselect(int fd, int flags, IOCallbackFunc iocb, void *data); extern void fd_select(time_t delay); /* backend-specific */ extern void fd_refresh(int fd); /* backend-specific */ diff --git a/src/list.c b/src/list.c index 26e8dfdc4..9ad77851c 100644 --- a/src/list.c +++ b/src/list.c @@ -244,11 +244,6 @@ Server *make_server(Client *client) del_from_id_hash_table(client->id, client); *client->id = '\0'; } - if (MyConnect(client) && (client->local->fd >= 0)) - { - /* Give servers a large socket buffer for performance */ - set_socket_buffers(client->local->fd, SERVER_SOCKET_RECEIVE_BUFFER, SERVER_SOCKET_SEND_BUFFER); - } return client->serv; } diff --git a/src/socket.c b/src/socket.c index 4bc67676a..b256ad380 100644 --- a/src/socket.c +++ b/src/socket.c @@ -703,10 +703,7 @@ void set_ipv6_opts(int fd) } /** This sets the *OS* socket buffers. - * Note that setting these high is not always a good idea. - * For example for regular users we keep the receive buffer tight - * so we detect a high receive queue (Excess Flood) properly. - * See include/fdlist.h for more information + * This shouldn't be needed anymore, but I've left the function here. */ void set_socket_buffers(int fd, int rcvbuf, int sndbuf) { @@ -726,17 +723,24 @@ void set_sock_opts(int fd, Client *client, int ipv6) if (ipv6) set_ipv6_opts(fd); + #ifdef SO_REUSEADDR opt = 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0) report_error("setsockopt(SO_REUSEADDR) %s:%s", client); #endif + #if defined(SO_USELOOPBACK) && !defined(_WIN32) opt = 1; if (setsockopt(fd, SOL_SOCKET, SO_USELOOPBACK, (void *)&opt, sizeof(opt)) < 0) report_error("setsockopt(SO_USELOOPBACK) %s:%s", client); #endif - set_socket_buffers(fd, USER_SOCKET_RECEIVE_BUFFER, USER_SOCKET_SEND_BUFFER); + + /* Previously we also called set_socket_buffers() to set some + * specific buffer limits. This is no longer needed on modern OS's. + * Setting it explicitly actually slows things down. + */ + /* Set to non blocking: */ #if !defined(_WIN32) if ((opt = fcntl(fd, F_GETFL, 0)) == -1)