List:Internals« Previous MessageNext Message »
From:'Hartmut Holzgraefe' Date:September 16 2005 1:39am
Subject:bk commit into 5.0 tree (hartmut:1.1964)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of hartmut. When hartmut does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1964 05/09/16 01:39:12 hartmut@stripped +1 -0
  Merge mysql.com:/home/hartmut/projects/mysql/dev/4.1
  into  mysql.com:/home/hartmut/projects/mysql/dev/5.0

  ndb/tools/ndb_config.cpp
    1.9 05/09/16 01:39:04 hartmut@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	hartmut
# Host:	linux.site
# Root:	/home/hartmut/projects/mysql/dev/5.0/RESYNC

--- 1.8/ndb/tools/ndb_config.cpp	2005-09-06 09:41:57 +02:00
+++ 1.9/ndb/tools/ndb_config.cpp	2005-09-16 01:39:04 +02:00
@@ -23,6 +23,8 @@
 #include <my_getopt.h>
 #include <mysql_version.h>
 
+#include <netdb.h>
+
 #include <NdbOut.hpp>
 #include <mgmapi.h>
 #include <mgmapi_configuration.hpp>
@@ -127,6 +129,11 @@
   virtual int eval(NdbMgmHandle, const Iter&);
 };
 
+struct HostMatch : public Match
+{
+  virtual int eval(NdbMgmHandle, const Iter&);
+};
+
 struct Apply
 {
   Apply() {}
@@ -297,9 +304,10 @@
   Match m;
   if(g_host)
   {
-    m.m_key = CFG_NODE_HOST;
-    m.m_value.assfmt("%s", g_host);
-    where.push_back(new Match(m));
+    HostMatch *m = new HostMatch;
+    m->m_key = CFG_NODE_HOST;
+    m->m_value.assfmt("%s", g_host);
+    where.push_back(m);
   }
   
   if(g_type)
@@ -373,6 +381,40 @@
     return 0;
   }
   return 1;
+}
+
+int
+HostMatch::eval(NdbMgmHandle h, const Iter& iter)
+{
+  const char* valc;
+  
+  if(iter.get(m_key, &valc) == 0)
+  {
+	  struct hostent *h1, *h2;
+
+	  h1 = gethostbyname(m_value.c_str());
+	  if (h1 == NULL) {
+		  return 0;
+	  }
+
+	  h2 = gethostbyname(valc);
+	  if (h2 == NULL) {
+		  return 0;
+	  }
+
+	  if (h1->h_addrtype != h2->h_addrtype) {
+		  return 0;
+	  }
+
+	  if (h1->h_length != h2->h_length) 
+	  {
+		  return 0;
+	  }
+	  
+	  return 0 == memcmp(h1->h_addr, h2->h_addr, h1->h_length);
+  }
+
+  return 0;
 }
 
 int
Thread
bk commit into 5.0 tree (hartmut:1.1964)'Hartmut Holzgraefe'16 Sep