From a6801c397732a55d2f9f477a360db6fc09bb1c3d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 May 1998 13:25:19 +0000 Subject: [PATCH] added a "socket options" option to rsyncd.conf. This option will provide hours of fun for those people who like to tune their systems to the utmost degree. --- clientserver.c | 2 ++ loadparm.c | 4 ++++ rsyncd.conf.yo | 7 +++++++ socket.c | 2 ++ 4 files changed, 15 insertions(+) diff --git a/clientserver.c b/clientserver.c index 121252b4..36477188 100644 --- a/clientserver.c +++ b/clientserver.c @@ -271,6 +271,8 @@ static int start_daemon(int fd) } set_socket_options(fd,"SO_KEEPALIVE"); + set_socket_options(fd,lp_socket_options()); + io_printf(fd,"@RSYNCD: %d\n", PROTOCOL_VERSION); diff --git a/loadparm.c b/loadparm.c index 482b41ba..a302f46a 100644 --- a/loadparm.c +++ b/loadparm.c @@ -101,6 +101,7 @@ typedef struct char *lock_file; int syslog_facility; int max_connections; + char *socket_options; } global; static global Globals; @@ -230,6 +231,7 @@ static struct parm_struct parm_table[] = {"motd file", P_STRING, P_GLOBAL, &Globals.motd_file, NULL, 0}, {"lock file", P_STRING, P_GLOBAL, &Globals.lock_file, NULL, 0}, {"syslog facility", P_ENUM, P_GLOBAL, &Globals.syslog_facility, enum_facilities,0}, + {"socket options", P_STRING, P_GLOBAL, &Globals.socket_options,NULL, 0}, {"name", P_STRING, P_LOCAL, &sDefault.name, NULL, 0}, {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, 0}, @@ -294,8 +296,10 @@ static void init_locals(void) FN_GLOBAL_STRING(lp_motd_file, &Globals.motd_file) FN_GLOBAL_STRING(lp_lock_file, &Globals.lock_file) +FN_GLOBAL_STRING(lp_socket_options, &Globals.socket_options) FN_GLOBAL_INTEGER(lp_max_connections, &Globals.max_connections) FN_GLOBAL_INTEGER(lp_syslog_facility, &Globals.syslog_facility) + FN_LOCAL_STRING(lp_name, name) FN_LOCAL_STRING(lp_comment, comment) FN_LOCAL_STRING(lp_path, path) diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo index 8b741b0b..05994f94 100644 --- a/rsyncd.conf.yo +++ b/rsyncd.conf.yo @@ -99,6 +99,13 @@ ftp, kern, lpr, mail, news, security, syslog, user, uucp, local0, local1, local2, local3, local4, local5, local6 and local7. The default is daemon. +dit(bf(socket options)) This option can provide endless fun for people +who like to tune their systems to the utmost degree. You can set all +sorts of socket options which may make transfers faster (or +slower!). Read the man page for the setsockopt() system call for +details on some of the options you may be able to set. By default no +special socket options are set. + enddit() diff --git a/socket.c b/socket.c index 27260a1b..3c876ed0 100644 --- a/socket.c +++ b/socket.c @@ -216,6 +216,8 @@ set user socket options void set_socket_options(int fd, char *options) { char *tok; + if (!options || !*options) return; + options = strdup(options); if (!options) out_of_memory("set_socket_options"); -- 2.34.1