[Gd-chatter] r10806 - in trunk/fundev/sources/network: . sockets unix-sockets

hannes at gwydiondylan.org hannes at gwydiondylan.org
Sun Jun 18 23:05:38 CEST 2006


Author: hannes
Date: Sun Jun 18 23:05:36 2006
New Revision: 10806

Added:
   trunk/fundev/sources/network/unix-sockets/x86-freebsd-sockets-data.dylan   (contents, props changed)
   trunk/fundev/sources/network/unix-sockets/x86-linux-sockets-data.dylan   (contents, props changed)
   trunk/fundev/sources/network/unix-sockets/x86-unix-sockets-data.dylan
      - copied, changed from r10752, trunk/fundev/sources/network/unix-sockets/x86-linux-sockets-data.dylan
   trunk/fundev/sources/network/x86-freebsd-network.lid
      - copied, changed from r10752, trunk/fundev/sources/network/x86-linux-network.lid
Modified:
   trunk/fundev/sources/network/sockets/unix-TCP-socket-accessor.dylan
   trunk/fundev/sources/network/unix-sockets/sockets-interfaces.dylan
   trunk/fundev/sources/network/x86-linux-network.lid
Log:
Bug: minor
*set socket option SO_REUSEADDR to avoid havin to wait 5 minutes, because
 there are still connections in TIME_WAIT and FIN_WAIT state.
*"Every UNIX is different from every other UNIX"^U
  SO_REUSEADDR, etc. are different on FreeBSD and Linux, support those
  differences


Modified: trunk/fundev/sources/network/sockets/unix-TCP-socket-accessor.dylan
==============================================================================
--- trunk/fundev/sources/network/sockets/unix-TCP-socket-accessor.dylan	(original)
+++ trunk/fundev/sources/network/sockets/unix-TCP-socket-accessor.dylan	Sun Jun 18 23:05:36 2006
@@ -17,6 +17,15 @@
   if (the-descriptor = $INVALID-SOCKET)
     unix-socket-error("unix-socket");
   end if;
+  with-stack-structure (int :: <C-int*>)
+    pointer-value(int) := 1;
+    let setsockopt-result =
+      setsockopt(the-descriptor, $SOL-SOCKET, $SO-REUSEADDR,
+                 int, size-of(<C-int*>));
+    if (setsockopt-result < 0)
+      unix-socket-error("setsockopt");
+    end;
+  end;
   the-descriptor
 end function;
 

Modified: trunk/fundev/sources/network/unix-sockets/sockets-interfaces.dylan
==============================================================================
--- trunk/fundev/sources/network/unix-sockets/sockets-interfaces.dylan	(original)
+++ trunk/fundev/sources/network/unix-sockets/sockets-interfaces.dylan	Sun Jun 18 23:05:36 2006
@@ -151,7 +151,7 @@
   parameter socket :: <C-int>;
   parameter level :: <C-int>;
   parameter option-name :: <C-int>;
-  parameter option-value :: <C-void*>;
+  parameter option-value :: <C-int*>;
   parameter option-len :: <socklen-t>;
   result val :: <C-int>;
   c-name: "setsockopt";

Added: trunk/fundev/sources/network/unix-sockets/x86-freebsd-sockets-data.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/network/unix-sockets/x86-freebsd-sockets-data.dylan	Sun Jun 18 23:05:36 2006
@@ -0,0 +1,22 @@
+Module: unix-sockets
+Synopsis: FreeBSD specific constants
+
+define constant $SOL-SOCKET = #xFFFF;
+
+define constant $SO-ACCEPTCONN = #x2;
+define constant $SO-BROADCAST = #x20;
+define constant $SO-DEBUG =	#x1;
+define constant $SO-DONTROUTE =	#x10;
+define constant $SO-KEEPALIVE =	#x8;
+define constant $SO-LINGER =	#x80;
+define constant $SO-OOBINLINE =	#x100;
+define constant $SO-REUSEADDR =	#x4;
+
+define constant $SO-RCVBUF =	#x1002;
+define constant $SO-RCVLOWAT =	#x1004;
+define constant $SO-RCVTIMEO =	#x1006;
+define constant $SO-SNDBUF =	#x1001;
+define constant $SO-SNDLOWAT =	#x1003;
+define constant $SO-SNDTIMEO =	#x1005;
+define constant $SO-TYPE =	#x1008;
+define constant $SO-ERROR =	#x1007;

Added: trunk/fundev/sources/network/unix-sockets/x86-linux-sockets-data.dylan
==============================================================================
--- (empty file)
+++ trunk/fundev/sources/network/unix-sockets/x86-linux-sockets-data.dylan	Sun Jun 18 23:05:36 2006
@@ -0,0 +1,27 @@
+Module: unix-sockets
+Synopsis: Linux specific constants
+
+//linux only
+define constant $PF-PACKET = 17;
+define constant $AF-PACKET =    $PF-PACKET;
+
+define constant $ETH-P-ALL = 3;
+
+define constant $SOL-SOCKET = 1;
+
+define constant $SO-ACCEPTCONN = ash(1, 16);
+define constant $SO-BROADCAST = 6;
+define constant $SO-DEBUG =	1;
+define constant $SO-DONTROUTE =	5;
+define constant $SO-ERROR =	4;
+define constant $SO-KEEPALIVE =	9;
+define constant $SO-LINGER =	13;
+define constant $SO-OOBINLINE =	10;
+define constant $SO-RCVBUF =	8;
+define constant $SO-RCVLOWAT =	18;
+define constant $SO-RCVTIMEO =	20;
+define constant $SO-REUSEADDR =	2;
+define constant $SO-SNDBUF =	7;
+define constant $SO-SNDLOWAT =	19;
+define constant $SO-SNDTIMEO =	21;
+define constant $SO-TYPE =	3;

Copied: trunk/fundev/sources/network/unix-sockets/x86-unix-sockets-data.dylan (from r10752, trunk/fundev/sources/network/unix-sockets/x86-linux-sockets-data.dylan)
==============================================================================
--- trunk/fundev/sources/network/unix-sockets/x86-linux-sockets-data.dylan	(original)
+++ trunk/fundev/sources/network/unix-sockets/x86-unix-sockets-data.dylan	Sun Jun 18 23:05:36 2006
@@ -57,36 +57,12 @@
 define constant $PF-LOCAL = 1;
 define constant $PF-UNIX = $PF-LOCAL;
 define constant $PF-INET = 2;
-define constant $PF-PACKET = 17;
 
 define constant $AF-UNIX =	$PF-UNIX;
 define constant $AF-INET =	$PF-INET;
-define constant $AF-PACKET =    $PF-PACKET;
 define constant $AF-UNSPEC =	$PF-UNSPEC;
 
-define constant $ETH-P-ALL = 3;
-
 define constant $SHUT-RD = 0;
 define constant $SHUT-WR = 1;
 define constant $SHUT-RDWR = 2;
 
-define constant $SOL-SOCKET = 1;
-
-define constant $SO-ACCEPTCONN = ash(1, 16);
-define constant $SO-BROADCAST = 6;
-define constant $SO-DEBUG =	1;
-define constant $SO-DONTROUTE =	5;
-define constant $SO-ERROR =	4;
-define constant $SO-KEEPALIVE =	9;
-define constant $SO-LINGER =	13;
-define constant $SO-OOBINLINE =	10;
-define constant $SO-RCVBUF =	8;
-define constant $SO-RCVLOWAT =	18;
-define constant $SO-RCVTIMEO =	20;
-define constant $SO-REUSEADDR =	2;
-define constant $SO-SNDBUF =	7;
-define constant $SO-SNDLOWAT =	19;
-define constant $SO-SNDTIMEO =	21;
-define constant $SO-TYPE =	3;
-
-// eof

Copied: trunk/fundev/sources/network/x86-freebsd-network.lid (from r10752, trunk/fundev/sources/network/x86-linux-network.lid)
==============================================================================
--- trunk/fundev/sources/network/x86-linux-network.lid	(original)
+++ trunk/fundev/sources/network/x86-freebsd-network.lid	Sun Jun 18 23:05:36 2006
@@ -5,7 +5,8 @@
 Major-Version: 2
 Minor-Version: 1
 Files:  unix-network-library
-        unix-sockets/x86-linux-sockets-data
+        unix-sockets/x86-unix-sockets-data
+        unix-sockets/x86-freebsd-sockets-data
         unix-sockets/sockets-interfaces
         unix-sockets/sockets-extras
         unix-sockets/x86-linux-address-data

Modified: trunk/fundev/sources/network/x86-linux-network.lid
==============================================================================
--- trunk/fundev/sources/network/x86-linux-network.lid	(original)
+++ trunk/fundev/sources/network/x86-linux-network.lid	Sun Jun 18 23:05:36 2006
@@ -5,6 +5,7 @@
 Major-Version: 2
 Minor-Version: 1
 Files:  unix-network-library
+        unix-sockets/x86-unix-sockets-data
         unix-sockets/x86-linux-sockets-data
         unix-sockets/sockets-interfaces
         unix-sockets/sockets-extras



More information about the chatter mailing list