OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa.c versions 1.47 and 1.48
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

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

--- sa.c 2002/01/02 13:27:11     1.47
+++ sa.c 2002/01/02 13:35:36     1.48
@@ -1143,6 +1143,25 @@
 #endif
             break;
         }
+        case SA_OPTION_REUSEADDR:
+        case SA_OPTION_REUSEPORT: {
+            /* enable/disable reusability of binding to address or port */
+            int mode = ((int)va_arg(ap, int) ? 1 : 0);
+            int flag;
+            if (sa->fdSocket == -1) {
+                rv = SA_ERR_USE;
+                break;
+            }
+            switch (id) {
+                case SA_OPTION_REUSEADDR: flag = SO_REUSEADDR; break;
+                case SA_OPTION_REUSEPORT: flag = SO_REUSEPORT; break;
+                default: flag = 0; break;
+            }
+            if (setsockopt(sa->fdSocket, SOL_SOCKET, flag, 
+                           (void *)&mode, sizeof(mode)) < 0)
+                rv = SA_ERR_SYS;
+            break;
+        }
         case SA_OPTION_NONBLOCK: {
             /* enable/disable non-blocking I/O mode */
             int flags;

CVSTrac 2.0.1