[netperf-dev] netperf2 commit notice r427 - trunk/src

raj at netperf.org raj at netperf.org
Tue Jul 12 15:15:42 PDT 2011


Author: raj
Date: 2011-07-12 15:15:42 -0700 (Tue, 12 Jul 2011)
New Revision: 427

Modified:
   trunk/src/netlib.c
   trunk/src/netlib.h
   trunk/src/netserver.c
   trunk/src/netsh.c
   trunk/src/nettest_bsd.c
Log:
a small step on what may be a long road to address family sanity

Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2011-07-12 18:58:00 UTC (rev 426)
+++ trunk/src/netlib.c	2011-07-12 22:15:42 UTC (rev 427)
@@ -225,6 +225,7 @@
 /* INVALID_SOCKET == INVALID_HANDLE_VALUE == (unsigned int)(~0) == -1 */
 SOCKET  netlib_control = INVALID_SOCKET;  
 SOCKET  server_sock = INVALID_SOCKET;
+int     control_family = AF_UNSPEC;
 
 /* global variables to hold the value for processor affinity */
 int     local_proc_affinity = -1,remote_proc_affinity = -1;
@@ -3027,8 +3028,9 @@
   } while ((error == EAI_AGAIN) && (count <= 5));
 
   if (error) {
-    printf("establish control: could not resolve host '%s' port '%s' af %s"
+    printf("%s: could not resolve host '%s' port '%s' af %s"
 	   "\n\tgetaddrinfo returned %d %s\n",
+	   __FUNCTION__,
            hostname,
            port,
            inet_ftos(family),
@@ -3198,6 +3200,8 @@
     close(control_sock);
   }
 
+  control_family = local_res_temp->ai_family;
+
   /* we no longer need the addrinfo stuff */
   freeaddrinfo(local_res);
   freeaddrinfo(remote_res);
@@ -3210,6 +3214,7 @@
 	    hostname,
 	    port);
     fflush(where);
+    control_family = AF_UNSPEC;
     return(INVALID_SOCKET);
   }
   /* at this point, we are connected.  we probably want some sort of

Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h	2011-07-12 18:58:00 UTC (rev 426)
+++ trunk/src/netlib.h	2011-07-12 22:15:42 UTC (rev 427)
@@ -456,6 +456,7 @@
 
 extern int local_data_family;
 extern int remote_data_family;
+extern int control_family;
 
 extern  union netperf_request_struct netperf_request;
 extern  union netperf_response_struct netperf_response;

Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c	2011-07-12 18:58:00 UTC (rev 426)
+++ trunk/src/netserver.c	2011-07-12 22:15:42 UTC (rev 427)
@@ -1138,6 +1138,8 @@
     while ((num_ready) && (candidate <= high_fd)) {
       if (FD_ISSET(candidate,&read_fds)) {
 	accept_connection(candidate);
+	FD_CLR(candidate,&read_fds);
+	num_ready--;
       }
       else {
 	candidate++;

Modified: trunk/src/netsh.c
===================================================================
--- trunk/src/netsh.c	2011-07-12 18:58:00 UTC (rev 426)
+++ trunk/src/netsh.c	2011-07-12 22:15:42 UTC (rev 427)
@@ -1065,6 +1065,7 @@
   }
   /* ok, what should our default hostname and local binding info be?
    */
+
   if ('\0' == host_name[0]) {
     /* host_name was not set */
     switch (address_family) {
@@ -1119,7 +1120,8 @@
     address_family = ai->ai_family;
     freeaddrinfo(ai);
   }
-  
+
+
   /* now, having established the name to which the control will
      connect, from what should it come? */
   if ('\0' == local_host_name[0]) {

Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c	2011-07-12 18:58:00 UTC (rev 426)
+++ trunk/src/nettest_bsd.c	2011-07-12 22:15:42 UTC (rev 427)
@@ -887,6 +887,10 @@
 void
 complete_addrinfos(struct addrinfo **remote,struct addrinfo **local, char remote_host[], int type, int protocol, int flags) {
 
+  if (remote_data_family == AF_UNSPEC) {
+    remote_data_family = control_family;
+  }
+  
   *remote = complete_addrinfo(remote_host,
 			      remote_data_address,
 			      remote_data_port,



More information about the netperf-dev mailing list