[netperf-dev] netperf4 commit notice r215 - branches/gobject_migration/src

raj at netperf.org raj at netperf.org
Wed Mar 14 16:27:15 PST 2007


Author: raj
Date: 2007-03-14 16:27:14 -0800 (Wed, 14 Mar 2007)
New Revision: 215

Modified:
   branches/gobject_migration/src/netperf-control.c
   branches/gobject_migration/src/netperf-control.h
   branches/gobject_migration/src/netperf-netserver.c
   branches/gobject_migration/src/netperf-netserver.h
   branches/gobject_migration/src/netperf-test.c
   branches/gobject_migration/src/netperf4.c
Log:
more work on the control object and initiating a control connection

Modified: branches/gobject_migration/src/netperf-control.c
===================================================================
--- branches/gobject_migration/src/netperf-control.c	2007-03-14 01:04:03 UTC (rev 214)
+++ branches/gobject_migration/src/netperf-control.c	2007-03-15 00:27:14 UTC (rev 215)
@@ -52,7 +52,13 @@
   CONTROL_PROP_DUMMY_0,    /* GObject does not like a zero value for a property id */
   CONTROL_PROP_ID,
   CONTROL_PROP_STATE,
-  CONTROL_PROP_REQ_STATE
+  CONTROL_PROP_REQ_STATE,
+  CONTROL_PROP_REMOTEHOST,
+  CONTROL_PROP_REMOTEPORT,
+  CONTROL_PROP_REMOTEFAMILY,
+  CONTROL_PROP_LOCALHOST,
+  CONTROL_PROP_LOCALPORT,
+  CONTROL_PROP_LOCALFAMILY
 };
 
 /* some forward declarations to make the compiler happy regardless of
@@ -74,7 +80,10 @@
   NEW_MESSAGE,        /* this would be the control connection object
 			 telling us a complete message has arrived. */
   CONTROL_CLOSED,     /* this would be the control connection object
-			 telling us the controll connection died. */
+			 telling us the control connection died. */
+  CONNECT,            /* this would be the netserver telling us to
+			 connect the control connection to the remote
+			 */ 
   LAST_SIGNAL         /* this should always be the last in the list so
 			 we can use it to size the array correctly. */
 };
@@ -82,10 +91,12 @@
 static void netperf_control_new_message(NetperfControl *control, gpointer message);
 static void netperf_control_control_closed(NetperfControl *control);
 
+static void netperf_control_connect(NetperfControl *control);
+
 /* a place to stash the id's returned by g_signal_new should we ever
    need to refer to them by their ID. */ 
 
-static guint netperf_control_signals[LAST_SIGNAL] = {0,0};
+static guint netperf_control_signals[LAST_SIGNAL] = {0,0,0};
 
 GType netperf_control_get_type(void) {
   static GType netperf_control_type = 0;
@@ -120,6 +131,12 @@
   GParamSpec *state_param;
   GParamSpec *req_state_param;
   GParamSpec *id_param;
+  GParamSpec *remotehost_param;
+  GParamSpec *remoteport_param;
+  GParamSpec *remotefamily_param;
+  GParamSpec *localhost_param;
+  GParamSpec *localport_param;
+  GParamSpec *localfamily_param;
 
   /* and on with the show */
   GObjectClass *g_object_class;
@@ -141,7 +158,7 @@
 		      "desired state of the control", /* description
 							   */
 		      CONTROL_PREINIT, /* min value */
-		      CONTROL_CLOSE,    /* max value */
+		      CONTROL_CLOSE,   /* max value */
 		      CONTROL_PREINIT, /* def value */
 		      G_PARAM_READWRITE); 
 
@@ -152,6 +169,49 @@
 			"unnamed",    /* default value */
 			G_PARAM_READWRITE);
 
+  remotehost_param = 
+    g_param_spec_string("remotehost",
+			"remote host",
+			"remote hostname or IP address",
+			"localhost",  /* belt and suspenders with the DTD */
+			G_PARAM_READWRITE);
+  remoteport_param = 
+    g_param_spec_string("remoteport",
+			"remote port",
+			"remote port number",
+			"56821",  /* belt and suspenders with the DTD */
+			G_PARAM_READWRITE);
+  remotefamily_param = 
+    g_param_spec_uint("remotefamily",
+		      "remote family",
+		      "remote address family",
+		      0,
+		      INT_MAX,
+		      AF_UNSPEC,
+		      G_PARAM_READWRITE);
+
+  localhost_param = 
+    g_param_spec_string("localhost",
+			"local host",
+			"local hostname or IP address",
+			"localhost",  /* belt and suspenders with the DTD */
+			G_PARAM_READWRITE);
+
+  localport_param = 
+    g_param_spec_string("localport",
+			"local port",
+			"local port name or number",
+			"0",  /* belt and suspenders with the DTD */
+			G_PARAM_READWRITE);
+  localfamily_param = 
+    g_param_spec_uint("localfamily",
+		      "local family",
+		      "local IP address family",
+		      0,
+		      INT_MAX,
+		      AF_UNSPEC,
+		      G_PARAM_READWRITE);
+
   /* overwrite the base object methods with our own get and set
      property routines */
 
@@ -171,12 +231,37 @@
 				  CONTROL_PROP_ID,
 				  id_param);
 
+  g_object_class_install_property(g_object_class,
+				  CONTROL_PROP_REMOTEHOST,
+				  remotehost_param);
+
+  g_object_class_install_property(g_object_class,
+				  CONTROL_PROP_REMOTEPORT,
+				  remoteport_param);
+
+  g_object_class_install_property(g_object_class,
+				  CONTROL_PROP_REMOTEFAMILY,
+				  remotefamily_param);
+
+  g_object_class_install_property(g_object_class,
+				  CONTROL_PROP_LOCALHOST,
+				  localhost_param);
+
+  g_object_class_install_property(g_object_class,
+				  CONTROL_PROP_LOCALPORT,
+				  localport_param);
+
+  g_object_class_install_property(g_object_class,
+				  CONTROL_PROP_LOCALFAMILY,
+				  localfamily_param);
+
   /* we would set the signal handlers for the class here. we might
      have a signal say for the arrival of a complete message or
      perhaps the cotnrol connection going down or somesuch. */
 
   klass->new_message = netperf_control_new_message;
   klass->control_closed = netperf_control_control_closed;
+  klass->connect_control = netperf_control_connect;
 
   netperf_control_signals[NEW_MESSAGE] = 
     g_signal_new("new_message",            /* signal name */
@@ -204,6 +289,16 @@
 		 g_cclosure_marshal_VOID__VOID,
 		 G_TYPE_NONE,
 		 0);
+  netperf_control_signals[CONTROL_CLOSED] = 
+    g_signal_new("connect",
+		 TYPE_NETPERF_CONTROL,
+		 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+		 G_STRUCT_OFFSET(NetperfControlClass, connect_control),
+		 NULL,
+		 NULL,
+		 g_cclosure_marshal_VOID__VOID,
+		 G_TYPE_NONE,
+		 0);
 }
 
 /* signal handler for new message */
@@ -225,6 +320,20 @@
   return;
 }
 
+static void netperf_control_connect(NetperfControl *control)
+{
+  g_print("asked to connect control at %p\n",control);
+
+  control->sockfd = establish_control(control->remotehost,
+				      control->remoteport,
+				      control->remotefamily,
+				      control->localhost,
+				      control->localport,
+				      control->localfamily);
+
+  /* REVISIT - do the g_io_channel stuff here */
+
+}
 /* get and set property routines */
 static void netperf_control_set_property(GObject *object,
 					   guint prop_id,
@@ -246,6 +355,30 @@
     control->state_req = req_state;
     break;
 
+  case CONTROL_PROP_REMOTEHOST:
+    control->remotehost = g_value_dup_string(value);
+    break;
+
+  case CONTROL_PROP_REMOTEPORT:
+    control->remoteport = g_value_dup_string(value);
+    break;
+
+  case CONTROL_PROP_REMOTEFAMILY:
+    control->remotefamily = g_value_get_uint(value);
+    break;
+
+  case CONTROL_PROP_LOCALHOST:
+    control->localhost = g_value_dup_string(value);
+    break;
+
+  case CONTROL_PROP_LOCALPORT:
+    control->localport = g_value_dup_string(value);
+    break;
+
+  case CONTROL_PROP_LOCALFAMILY:
+    control->localfamily = g_value_get_uint(value);
+    break;
+
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
     break;
@@ -270,6 +403,30 @@
     g_value_set_uint(value, control->state_req);
     break;
 
+  case CONTROL_PROP_REMOTEHOST:
+    g_value_set_string(value, control->remotehost);
+    break;
+
+  case CONTROL_PROP_REMOTEPORT:
+    g_value_set_string(value, control->remoteport);
+    break;
+
+  case CONTROL_PROP_REMOTEFAMILY:
+    g_value_set_uint(value, control->remotefamily);
+    break;
+
+  case CONTROL_PROP_LOCALHOST:
+    g_value_set_string(value, control->localhost);
+    break;
+
+  case CONTROL_PROP_LOCALPORT:
+    g_value_set_string(value, control->localport);
+    break;
+
+  case CONTROL_PROP_LOCALFAMILY:
+    g_value_set_uint(value, control->localfamily);
+    break;
+
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
     break;

Modified: branches/gobject_migration/src/netperf-control.h
===================================================================
--- branches/gobject_migration/src/netperf-control.h	2007-03-14 01:04:03 UTC (rev 214)
+++ branches/gobject_migration/src/netperf-control.h	2007-03-15 00:27:14 UTC (rev 215)
@@ -54,13 +54,20 @@
   control_state_t  state;     /* the present state of the control */
   control_state_t  state_req; /* the state in which we want the control
 				 to be*/
+  gchar *remotehost;
+  gchar *remoteport;
+  gchar *localhost;
+  gchar *localport;
 
+  guint remotefamily;
+  guint localfamily;
+
   /* private */
   /* things which I think will remain purely private */
   GIOChannel  *source;   /* the io channel over which we communicate
 			    with the remote control.  */
 
-  int  sockfd;    /* the file descriptor associated with the
+  int  sockfd;    /* REVISIT the file descriptor associated with the
 		     socket. THIS NEEDS TO CHANGE TO "SOCKET" ASAP */
 
   /* do we need anything to store messages which could not be sent
@@ -84,6 +91,7 @@
   /* signals */
   void (*new_message)(NetperfControl *control, gpointer message);
   void (*control_closed)(NetperfControl *control);
+  void (*connect_control)(NetperfControl *control);
 
   /* methods */
 } NetperfControlClass;

Modified: branches/gobject_migration/src/netperf-netserver.c
===================================================================
--- branches/gobject_migration/src/netperf-netserver.c	2007-03-14 01:04:03 UTC (rev 214)
+++ branches/gobject_migration/src/netperf-netserver.c	2007-03-15 00:27:14 UTC (rev 215)
@@ -40,12 +40,17 @@
 #include <stdio.h>
 #endif
 
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
 #include "netperf.h"
 #include "netlib.h"
+#include "netperf-control.h"
 #include "netperf-netserver.h"
 #include "netperf-test.h"
 
@@ -153,6 +158,8 @@
 enum {
   NEW_MESSAGE,        /* this would be the control connection object
 			 telling us a complete message has arrived. */
+  CONNECT_CONTROL,    /* tells us to go ahead and establish a control
+			 connection */ 
   CONTROL_CLOSED,     /* this would be the control connection object
 			 telling us the controll connection died. */
   LAST_SIGNAL         /* this should always be the last in the list so
@@ -162,13 +169,15 @@
 			 working happened to do so... */
 };
 
+static void netperf_netserver_connect(NetperfNetserver *netserver);
 static void netperf_netserver_new_message(NetperfNetserver *netserver, gpointer message);
 static void netperf_netserver_control_closed(NetperfNetserver *netserver);
+static void netperf_netserver_connect_control(NetperfNetserver *netserver);
 
 /* a place to stash the id's returned by g_signal_new should we ever
    need to refer to them by their ID. */ 
 
-static guint netperf_netserver_signals[LAST_SIGNAL] = {0,0};
+static guint netperf_netserver_signals[LAST_SIGNAL] = {0,0,0};
 
 GType netperf_netserver_get_type(void) {
   static GType netperf_netserver_type = 0;
@@ -285,6 +294,7 @@
 
   klass->new_message = netperf_netserver_new_message;
   klass->control_closed = netperf_netserver_control_closed;
+  klass->connect_control = netperf_netserver_connect_control;
 
   netperf_netserver_signals[NEW_MESSAGE] = 
     g_signal_new("new_message",            /* signal name */
@@ -312,8 +322,57 @@
 		 g_cclosure_marshal_VOID__VOID,
 		 G_TYPE_NONE,
 		 0);
+
+  netperf_netserver_signals[CONNECT_CONTROL] = 
+    g_signal_new("connect_control",
+		 TYPE_NETPERF_NETSERVER,
+		 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+		 G_STRUCT_OFFSET(NetperfNetserverClass, connect_control),
+		 NULL,
+		 NULL,
+		 g_cclosure_marshal_VOID__VOID,
+		 G_TYPE_NONE,
+		 0);
+		 
 }
 
+char *
+netperf_netserver_state_to_string(int value)
+{
+  char *state; 
+
+  switch (value) {
+  case NETSERVER_PREINIT:
+    state = "PREINIT";
+    break;
+  case NETSERVER_CONNECTED:
+    state = "CONNECTED";
+    break;
+  case NETSERVER_VERS:
+    state = "VERSION";
+    break;
+  case NETSERVER_INIT:
+    state = "INIT";
+    break;
+  case NETSERVER_WORK:
+    state = "WORK";
+    break;
+  case NETSERVER_ERROR:
+    state = "ERROR";
+    break;
+  case NETSERVER_CLOSE:
+    state = "CLOSE";
+    break;
+  case NETSERVER_EXIT:
+    state = "EXIT";
+    break;
+  default:
+    state = "UNKNOWN";
+    break;
+  }
+  return state;
+}
+
 /* a bunch of the message processing code, originally from netmsg.c */
 int
 process_message(NetperfNetserver *server, xmlDocPtr doc)
@@ -1382,6 +1441,139 @@
   return;
 }
 
+/* signal handler to tell us to establish the control connection */
+static void netperf_netserver_connect_control(NetperfNetserver *server)
+{
+
+  xmlChar   *remotehost;
+  xmlChar   *remoteport;
+  xmlChar   *localhost;
+  xmlChar   *localport;
+
+  int      localfamily;
+  int      remotefamily;
+
+  /* validation means that we know that the host informaion is in attributes
+     of the netserver element. The xml parser checked them and initialized
+     any optional attributes which where not present.  sgb 2003-10-11 */
+
+  /* pull the remote address family, service and host attributes */
+  remotefamily = strtofam(xmlGetProp(server->node,(const xmlChar *)"family"));
+  remoteport   = xmlGetProp(server->node,(const xmlChar *)"remote_service");
+  remotehost   = xmlGetProp(server->node,(const xmlChar *)"remote_host");
+
+  /* for the time being, the netserver element definition provides only
+     one family attribute - this means no mixed family stuff, which should
+     not be a problem for the moment.  since getaddrinfo() takes a servname
+     parm as an ASCII string we will just pass the string. sgb 2003-10-11 */
+
+  /* now pull the local address family, service and host attributes */
+  localfamily  = strtofam(xmlGetProp(server->node,(const xmlChar *)"family"));
+  localport    = xmlGetProp(server->node,(const xmlChar *)"local_service");
+  localhost    = xmlGetProp(server->node,(const xmlChar *)"local_host");
+
+  g_print("server %s asking for new control object with remote %s %s %d local %s %s %d\n",
+	  server->id,
+	  remotehost, 
+	  remoteport,
+	  remotefamily,
+	  localhost,
+	  localport,
+	  localfamily);
+
+  /* armed with this information, create a control object and give it
+     what it needs to do its work, then tell it to go ahead and
+     connect. should this become a g_object_weak_pointer reference? */
+  server->control_object= g_object_new(TYPE_NETPERF_CONTROL,
+				       "remotefamily", remotefamily,
+				       "remotehost", remotehost,
+				       "remoteport", remoteport,
+				       "localfamily", localfamily,
+				       "localhost", localhost,
+				       "localport", localport,
+				       NULL);
+
+  /* and now signal it to connect-up */
+  g_signal_emit_by_name(server->control_object,
+			"connect");
+
+}
+
+static void netperf_netserver_set_state(NetperfNetserver *netserver, guint req_state) 
+{
+
+  NETPERF_DEBUG_ENTRY(debug,where);
+  switch(req_state) {
+  case NETSERVER_PREINIT:
+    /* probably bad to ask a netserver to go to the preinit state? */
+    break;
+
+  case NETSERVER_CONNECTED:
+    /* OK if we are in the PREINIT state, bad otherwise */
+    if (NETSERVER_PREINIT == netserver->state) {
+      /* go ahead and do whatever we need to do */
+      netserver->state_req = req_state;
+    }
+    else {
+      /* badness */
+    }
+    break;
+
+  case NETSERVER_VERS:
+    /* OK if we are in the CONNECTED state, bad otherwise */
+    if (NETSERVER_CONNECTED == netserver->state) {
+      /* go ahead and do whatever we need to do */
+      netserver->state_req = req_state;
+    }
+    else {
+      /* badness */
+    }
+    break;
+
+  case NETSERVER_INIT:
+    /* OK if we are in the CONNECTED state, bad otherwise */
+    if (NETSERVER_VERS == netserver->state) {
+      /* go ahead and do whatever we need to do */
+      netserver->state_req = req_state;
+    }
+    else {
+      /* badness */
+    }
+    break;
+
+  case NETSERVER_WORK:
+    /* OK if we are in the CONNECTED state, bad otherwise */
+    if (NETSERVER_INIT == netserver->state) {
+      /* go ahead and do whatever we need to do */
+      netserver->state_req = req_state;
+    }
+    else {
+      /* badness */
+    }
+    break;
+
+  case NETSERVER_ERROR:
+    /* we can enter the ERROR state any time */
+    netserver->state_req = req_state;
+
+    break;
+
+  case NETSERVER_CLOSE:
+    /* not sure what we do here - do we allow a transition to CLOSE
+       only from the WORK state, or something else? */
+    break;
+
+  case NETSERVER_EXIT:
+    /* not sure what to do here */
+    break;
+ 
+  default:
+    /* naughty naughty */
+    g_print("invalid state provided\n");
+  }
+  NETPERF_DEBUG_EXIT(debug,where);
+}
+
 /* get and set property routines */
 static void netperf_netserver_set_property(GObject *object,
 					   guint prop_id,
@@ -1389,7 +1581,6 @@
 					   GParamSpec *pspec) {
   NetperfNetserver *netserver;
   guint req_state;
-  void *temp_ptr;
 
   netserver = NETPERF_NETSERVER(object);
 
@@ -1401,7 +1592,7 @@
     req_state = g_value_get_uint(value);
     /* we really need to sanity check the reqeusted state against the
        current state here... */
-    netserver->state_req = req_state;
+    netperf_netserver_set_state(netserver,req_state);
     break;
 
   case NETSERVER_PROP_ID:
@@ -1409,8 +1600,11 @@
     break;
 
   case NETSERVER_PROP_CONTROL_CONNECTION:
+    /* I don't think we'll ever be setting this one */
+#ifdef notdef
     temp_ptr = g_value_get_pointer(value);
-    g_object_add_weak_pointer(temp_ptr,&(netserver->control_connection));
+    g_object_add_weak_pointer(temp_ptr,&(netserver->control_object));
+#endif
     break;
 
   case NETSERVER_PROP_NODE:
@@ -1446,7 +1640,7 @@
     break;
 
   case NETSERVER_PROP_CONTROL_CONNECTION:
-    g_value_set_pointer(value, netserver->control_connection);
+    g_value_set_pointer(value, netserver->control_object);
     break;
 
   case NETSERVER_PROP_NODE:

Modified: branches/gobject_migration/src/netperf-netserver.h
===================================================================
--- branches/gobject_migration/src/netperf-netserver.h	2007-03-14 01:04:03 UTC (rev 214)
+++ branches/gobject_migration/src/netperf-netserver.h	2007-03-15 00:27:14 UTC (rev 215)
@@ -113,8 +113,9 @@
   /* do we need to have references to the test instances associated
      with this netserver instance? */
 
-  /* we do want a weak pointer for the control object */
-  void *control_connection;
+  /* we do want a g_object_weak_pointer for the control object? should
+     this be a different type than just void? */
+  void *control_object;
 
 };
 
@@ -128,6 +129,7 @@
   /* signals */
   void (*new_message)(NetperfNetserver *netserver, gpointer message);
   void (*control_closed)(NetperfNetserver *netserver);
+  void (*connect_control)(NetperfNetserver *netserver);
 
   /* methods */
 };

Modified: branches/gobject_migration/src/netperf-test.c
===================================================================
--- branches/gobject_migration/src/netperf-test.c	2007-03-14 01:04:03 UTC (rev 214)
+++ branches/gobject_migration/src/netperf-test.c	2007-03-15 00:27:14 UTC (rev 215)
@@ -110,6 +110,40 @@
 
 static guint netperf_test_signals[LAST_SIGNAL] = {0,0,0,0};
 
+char *
+netperf_test_state_to_string(int value)
+{
+  char *state; 
+
+  switch (value) {
+  case NP_TST_PREINIT:
+    state = "PREINIT";
+    break;
+  case NP_TST_INIT:
+    state = "INIT";
+    break;
+  case NP_TST_IDLE:
+    state = "IDLE";
+    break;
+  case NP_TST_MEASURE:
+    state = "MEASURE";
+    break;
+  case NP_TST_LOADED:
+    state = "LOAD";
+    break;
+  case NP_TST_ERROR:
+    state = "ERROR";
+    break;
+  case NP_TST_DEAD:
+    state = "DEAD";
+    break;
+  default:
+    state = "UNKNOWN";
+    break;
+  }
+  return state;
+}
+
 GType netperf_test_get_type(void) {
   static GType netperf_test_type = 0;
 

Modified: branches/gobject_migration/src/netperf4.c
===================================================================
--- branches/gobject_migration/src/netperf4.c	2007-03-14 01:04:03 UTC (rev 214)
+++ branches/gobject_migration/src/netperf4.c	2007-03-15 00:27:14 UTC (rev 215)
@@ -386,6 +386,7 @@
 }
 
 
+/* should this be in netperf-netserver.c? */
 void print_netserver_hash_entry(gpointer key, gpointer value, gpointer user_data)
 {
   NetperfNetserver *netserver;
@@ -410,7 +411,12 @@
 	       "id", &id,
 	       "node", &node,
 	       NULL);
-  g_print("state: %d req_state: %d id %s\n",state,req_state,id);
+  g_print("state: %s (%d) req_state: %s (%d) id %s\n",
+	  netperf_netserver_state_to_string(state),
+	  state,
+	  netperf_netserver_state_to_string(req_state),
+	  req_state,
+	  id);
   g_print("node: %p\n",node);
 
   /* seems we cannot just dump a node absent a doc... */
@@ -453,12 +459,14 @@
 	       "id", &id,
 	       "node", &node,
 	       NULL);
-  g_print("test: %s, object %p, user_data %p id %s state %d req_state %d node %p\n",
+  g_print("test: %s, object %p, user_data %p id %s state %s (%d) req_state %s (%d) node %p\n",
 	  (char *)key,
 	  value,
 	  user_data,
 	  id,
+	  netperf_test_state_to_string(state),
 	  state,
+	  netperf_test_state_to_string(state),
 	  req_state,
 	  node);
 
@@ -538,44 +546,6 @@
 
 
 
-
-static SOCKET
-connect_netserver(xmlDocPtr doc, xmlNodePtr netserver, server_t *new_server)
-{
-  xmlChar   *remotehost;
-  xmlChar   *remoteport;
-  xmlChar   *localhost;
-  xmlChar   *localport;
-
-  int      localfamily;
-  int      remotefamily;
-  SOCKET      sock;
-
-  /* validation means that we know that the host informaion is in attributes
-     of the netserver element. The xml parser checked them and initialized
-     any optional attributes which where not present.  sgb 2003-10-11 */
-
-  /* pull the remote address family, service and host attributes */
-  remotefamily = strtofam(xmlGetProp(netserver,(const xmlChar *)"family"));
-  remoteport   = xmlGetProp(netserver,(const xmlChar *)"remote_service");
-  remotehost   = xmlGetProp(netserver,(const xmlChar *)"remote_host");
-
-  /* for the time being, the netserver element definition provides only
-     one family attribute - this means no mixed family stuff, which should
-     not be a problem for the moment.  since getaddrinfo() takes a servname
-     parm as an ASCII string we will just pass the string. sgb 2003-10-11 */
-
-  /* now pull the local address family, service and host attributes */
-  localfamily  = strtofam(xmlGetProp(netserver,(const xmlChar *)"family"));
-  localport    = xmlGetProp(netserver,(const xmlChar *)"local_service");
-  localhost    = xmlGetProp(netserver,(const xmlChar *)"local_host");
-
-  /* and now call establish_control */
-  sock = establish_control(remotehost, remoteport, remotefamily,
-                           localhost,  localport,  localfamily);
-  return(sock);
-}
-
 static gboolean periodic_callback(gpointer data)
 {
   static int i = 1;
@@ -956,8 +926,17 @@
 	   connection/object. should we create it explicitly here, or
 	   should it be done when the "node" property is set as that
 	   is, presumably, where the addressing info happens to be? it
-	   should probably be after the netserver has been added to the
-	   server_hash on the off chance that messages start arriving */
+	   should probably be after the netserver has been added to
+	   the server_hash on the off chance that messages start
+	   arriving.  for now since the addressing information is
+	   embedded in the netserver XML node, we want to at least go
+	   through the netserver object so we will "signal" the object
+	   we want it to establish the control connection and let it
+	   decide whether that control will be a separate control
+	   object or not */
+	g_print("asking new server to connect\n");
+	g_signal_emit_by_name(new_server,
+			      "connect_control");
       }
       /* lets go ahead and add the tests associated with this
 	 netserver */



More information about the netperf-dev mailing list