Remove support for timeout option
authorWouter Verhelst <w@uter.be>
Sat, 23 May 2009 07:45:51 +0000 (09:45 +0200)
committerWouter Verhelst <w@uter.be>
Sat, 23 May 2009 07:45:51 +0000 (09:45 +0200)
The timeout option has been broken for a very long time. Additionally,
something like this is better done by making use of TCP keepalive
probes, which nbd-server has implemented since 2003 (unless you're using
it in inetd mode, in which case you should add the keepalive option to
the inetd configuration for the nbd-server).

nbd-server.1.in
nbd-server.1.sgml
nbd-server.c

index c9187eb..d868ae0 100644 (file)
@@ -3,13 +3,13 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "NBD-SERVER" "1" "03 January 2009" "" ""
+.TH "NBD-SERVER" "1" "23 May 2009" "" ""
 
 .SH NAME
 nbd-server \- serve a file as a block device to other computers    running the GNU/Linux(tm) or GNU/Hurd Operating    System
 .SH SYNOPSIS
 
-\fBnbd-server \fR \fB\fI[ip:]port\fB\fR \fB\fIfilename\fB\fR [ \fB\fIsize\fB\fR ] [ \fB-r\fR ] [ \fB-m\fR ] [ \fB-c\fR ] [ \fB-a \fItimeout\fB\fR ] [ \fB-l \fIhost list filename\fB\fR ] [ \fB-o \fIsection name\fB\fR ] [ \fB-C \fIconfig file\fB\fR ]
+\fBnbd-server \fR \fB\fI[ip:]port\fB\fR \fB\fIfilename\fB\fR [ \fB\fIsize\fB\fR ] [ \fB-r\fR ] [ \fB-m\fR ] [ \fB-c\fR ] [ \fB-l \fIhost list filename\fB\fR ] [ \fB-o \fIsection name\fB\fR ] [ \fB-C \fIconfig file\fB\fR ]
 
 .SH "DESCRIPTION"
 .PP
@@ -100,12 +100,6 @@ file entirely, either move it away or use the -C option to
 point \fBnbd-server\fR(1) to a non-existing or
 empty configuration file.
 .TP
-\fBtimeout\fR
-Maximum number of idle seconds. If a connection is
-inactive for this amount of time, it is terminated; this is to
-avoid stale nbd-server processes staying in memory. Use of
-this option is strongly recommended.
-.TP
 \fBhost list filename\fR
 This argument should contain a list of IP-addresses
 for hosts that may connect to the server. Wildcards are
index 9f651d7..81b235a 100644 (file)
@@ -63,7 +63,6 @@ manpage.1: manpage.sgml
       <arg><option>-r</option></arg>
       <arg><option>-m</option></arg>
       <arg><option>-c</option></arg>
-      <arg><option>-a <replaceable>timeout</replaceable></option></arg>
       <arg><option>-l <replaceable>host list filename</replaceable></option></arg>
       <arg><option>-o <replaceable>section name</replaceable></option></arg>
       <arg><option>-C <replaceable>config file</replaceable></option></arg>
@@ -187,15 +186,6 @@ manpage.1: manpage.sgml
        </listitem>
       </varlistentry>
       <varlistentry>
-       <term><option>timeout</option></term>
-       <listitem>
-         <para>Maximum number of idle seconds. If a connection is
-           inactive for this amount of time, it is terminated; this is to
-           avoid stale nbd-server processes staying in memory. Use of
-           this option is strongly recommended.</para>
-       </listitem>
-      </varlistentry>
-      <varlistentry>
        <term><option>host list filename</option></term>
        <listitem>
          <para>This argument should contain a list of IP-addresses
index 5c35e06..36ea351 100644 (file)
@@ -176,8 +176,6 @@ typedef struct {
        unsigned int port;   /**< port we're exporting this file at */
        char* authname;      /**< filename of the authorization file */
        int flags;           /**< flags associated with this exported file */
-       unsigned int timeout;/**< how long a connection may be idle
-                              (0=forever) */
        int socket;          /**< The socket of this server. */
        VIRT_STYLE virtstyle;/**< The style of virtualization, if any */
        uint8_t cidrlen;     /**< The length of the mask when we use
@@ -335,7 +333,7 @@ inline void writeit(int f, void *buf, size_t len) {
  */
 void usage() {
        printf("This is nbd-server version " VERSION "\n");
-       printf("Usage: [ip:]port file_to_export [size][kKmM] [-l authorize_file] [-r] [-m] [-c] [-a timeout_sec] [-C configuration file] [-p PID file name] [-o section name]\n"
+       printf("Usage: [ip:]port file_to_export [size][kKmM] [-l authorize_file] [-r] [-m] [-c] [-C configuration file] [-p PID file name] [-o section name]\n"
               "\t-r|--read-only\t\tread only\n"
               "\t-m|--multi-file\t\tmultiple file\n"
               "\t-c|--copy-on-write\tcopy on write\n"
@@ -372,9 +370,6 @@ void dump_section(SERVER* serve, gchar* section_header) {
        if(serve->authname) {
                printf("\tauthfile = %s\n", serve->authname);
        }
-       if(serve->timeout) {
-               printf("\ttimeout = %d\n", serve->timeout);
-       }
        exit(EXIT_SUCCESS);
 }
 
@@ -478,9 +473,6 @@ SERVER* cmdline(int argc, char *argv[]) {
                        g_free(serve->authname);
                        serve->authname=g_strdup(optarg);
                        break;
-               case 'a': 
-                       serve->timeout=strtol(optarg, NULL, 0);
-                       break;
                default:
                        usage();
                        exit(EXIT_FAILURE);
@@ -549,7 +541,6 @@ GArray* parse_cfile(gchar* f, GError** e) {
                { "exportname", TRUE,   PARAM_STRING,   NULL, 0 },
                { "port",       TRUE,   PARAM_INT,      NULL, 0 },
                { "authfile",   FALSE,  PARAM_STRING,   NULL, 0 },
-               { "timeout",    FALSE,  PARAM_INT,      NULL, 0 },
                { "filesize",   FALSE,  PARAM_INT,      NULL, 0 },
                { "virtstyle",  FALSE,  PARAM_STRING,   NULL, 0 },
                { "prerun",     FALSE,  PARAM_STRING,   NULL, 0 },
@@ -600,14 +591,13 @@ GArray* parse_cfile(gchar* f, GError** e) {
                lp[0].target=&(s.exportname);
                lp[1].target=&(s.port);
                lp[2].target=&(s.authname);
-               lp[3].target=&(s.timeout);
-               lp[4].target=&(s.expected_size);
-               lp[5].target=&(virtstyle);
-               lp[6].target=&(s.prerun);
-               lp[7].target=&(s.postrun);
-               lp[8].target=lp[9].target=lp[10].target=
-                               lp[11].target=lp[12].target=&(s.flags);
-               lp[13].target=&(s.listenaddr);
+               lp[3].target=&(s.expected_size);
+               lp[4].target=&(virtstyle);
+               lp[5].target=&(s.prerun);
+               lp[6].target=&(s.postrun);
+               lp[7].target=lp[8].target=lp[9].target=
+                               lp[10].target=lp[11].target=&(s.flags);
+               lp[12].target=&(s.listenaddr);
 
                /* After the [generic] group, start parsing exports */
                if(i==1) {
@@ -1117,8 +1107,6 @@ int mainloop(CLIENT *client) {
                i++;
                printf("%d: ", i);
 #endif
-               if (client->server->timeout) 
-                       alarm(client->server->timeout);
                readit(client->net, &request, sizeof(request));
                request.from = ntohll(request.from);
                request.type = ntohl(request.type);