OSSP CVS Repository

ossp - Check-in [1485]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1485
Date: 2002-Jan-02 14:44:48 (local)
2002-Jan-02 13:44:48 (UTC)
User:rse
Branch:
Comment: add support for lingering on close
Tickets:
Inspections:
Files:
ossp-pkg/sa/sa.c      1.48 -> 1.49     15 inserted, 0 deleted
ossp-pkg/sa/sa.h      1.27 -> 1.28     1 inserted, 0 deleted
ossp-pkg/sa/sa.pod      1.21 -> 1.22     12 inserted, 8 deleted

ossp-pkg/sa/sa.c 1.48 -> 1.49

--- sa.c 2002/01/02 13:35:36     1.48
+++ sa.c 2002/01/02 13:44:48     1.49
@@ -1143,6 +1143,21 @@
 #endif
             break;
         }
+        case SA_OPTION_LINGER: {
+#if defined(SO_LINGER)
+            struct linger *linger = (struct linger *)va_arg(ap, void *);
+            if (sa->fdSocket == -1) {
+                rv = SA_ERR_USE;
+                break;
+            }
+            if (setsockopt(sa->fdSocket, SOL_SOCKET, SO_LINGER, 
+                           linger, sizeof(struct linger)) < 0)
+                rv = SA_ERR_SYS;
+#else
+            rv = SA_ERR_IMP;
+#endif
+            break;
+        }
         case SA_OPTION_REUSEADDR:
         case SA_OPTION_REUSEPORT: {
             /* enable/disable reusability of binding to address or port */


ossp-pkg/sa/sa.h 1.27 -> 1.28

--- sa.h 2002/01/02 13:35:36     1.27
+++ sa.h 2002/01/02 13:44:48     1.28
@@ -138,6 +138,7 @@
 /* list of options */
 typedef enum {
     SA_OPTION_NAGLE,
+    SA_OPTION_LINGER,
     SA_OPTION_REUSEADDR,
     SA_OPTION_REUSEPORT,
     SA_OPTION_NONBLOCK


ossp-pkg/sa/sa.pod 1.21 -> 1.22

--- sa.pod       2002/01/02 13:35:36     1.21
+++ sa.pod       2002/01/02 13:44:48     1.22
@@ -435,15 +435,19 @@
 the expected following argument(s) are dependent on the particular
 option. Currently the following options are implement (option arguments
 in parenthesis): C<SA_OPTION_NAGLE> (C<int> I<yesno>) for enabling
-(I<yesno>=C<1>) or disabling (I<yesno>=C<0>) Nagle's Algorithm (see
-RFC898); C<SA_OPTION_REUSEADDR> (C<int> I<yesno>) for enabling
-(I<yesno>=C<1>) or disabling (I<yesno>=C<0>) the reusability of
-the address on binding (see C<SO_REUSEADDR> of setsockopt(2)),
-C<SA_OPTION_REUSEPORT> (C<int> I<yesno>) for enabling (I<yesno>=C<1>)
-or disabling (I<yesno>=C<0>) the reusability of the port on binding
-(see C<SO_REUSEPORT> of setsockopt(2)), C<SA_OPTION_NONBLOCK> (C<int>
+(I<yesno>=C<1>) or disabling (I<yesno>=C<0>) Nagle's Algorithm
+(see RFC898); C<SA_OPTION_LINGER> (C<struct linger *>I<linger>) for enabling
+(C<linger-E<gt>l_onoff>=C<1>) or disabling (C<linger-E<gt>l_onoff>=C<0>
+and C<linger-E<gt>l_linger=I<seconds>) lingering on close (see
+C<struct linger> in F<sys/socket.h>); C<SA_OPTION_REUSEADDR> (C<int>
 I<yesno>) for enabling (I<yesno>=C<1>) or disabling (I<yesno>=C<0>)
-non-blocking I/O mode (see C<O_NONBLOCK> of fcntl(2)).
+the reusability of the address on binding (see C<SO_REUSEADDR>
+of setsockopt(2)), C<SA_OPTION_REUSEPORT> (C<int> I<yesno>) for
+enabling (I<yesno>=C<1>) or disabling (I<yesno>=C<0>) the reusability
+of the port on binding (see C<SO_REUSEPORT> of setsockopt(2)),
+C<SA_OPTION_NONBLOCK> (C<int> I<yesno>) for enabling (I<yesno>=C<1>) or
+disabling (I<yesno>=C<0>) non-blocking I/O mode (see C<O_NONBLOCK> of
+fcntl(2)).
 
 Example: C<sa_option(sa, SA_OPTION_NONBLOCK, 1);>
 

CVSTrac 2.0.1