summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2005-07-15 14:13:23 +0200
committerunknown <tomas@poseidon.ndb.mysql.com>2005-07-15 14:13:23 +0200
commit51229d4ba285a947d2a5675cc1d67a445738de21 (patch)
treea39c5ee7d8d705681658c40e6e3929376c65227d /ndb
parentdbbd54e5a8499c46459e80f794e6232053ccdfd7 (diff)
parent2a48132e01d6a52559cd6e9ad9145c9484e00c24 (diff)
downloadmariadb-git-51229d4ba285a947d2a5675cc1d67a445738de21.tar.gz
Merge
mysql-test/t/ctype_utf8.test: Auto merged ndb/src/common/mgmcommon/ConfigRetriever.cpp: Auto merged ndb/src/common/transporter/Transporter.hpp: Auto merged ndb/src/common/transporter/TransporterRegistry.cpp: Auto merged ndb/src/mgmclient/CommandInterpreter.cpp: Auto merged ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged ndb/src/mgmsrv/MgmtSrvr.hpp: Auto merged ndb/src/mgmsrv/Services.cpp: Auto merged sql/sql_prepare.cc: Auto merged support-files/mysql.spec.sh: Auto merged tests/mysql_client_test.c: Auto merged ndb/include/transporter/TransporterRegistry.hpp: SCCS merged ndb/src/common/transporter/Transporter.cpp: SCCS merged
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/transporter/TransporterRegistry.hpp2
-rw-r--r--ndb/src/common/mgmcommon/ConfigRetriever.cpp8
-rw-r--r--ndb/src/common/transporter/Transporter.cpp15
-rw-r--r--ndb/src/common/transporter/Transporter.hpp1
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp6
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp18
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.hpp2
7 files changed, 47 insertions, 5 deletions
diff --git a/ndb/include/transporter/TransporterRegistry.hpp b/ndb/include/transporter/TransporterRegistry.hpp
index 1ae8a4068c4..0bb9733e8c4 100644
--- a/ndb/include/transporter/TransporterRegistry.hpp
+++ b/ndb/include/transporter/TransporterRegistry.hpp
@@ -268,6 +268,8 @@ public:
Transporter* get_transporter(NodeId nodeId);
NodeId get_localNodeId() { return localNodeId; };
+
+ struct in_addr get_connect_address(NodeId node_id) const;
protected:
private:
diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
index b8ce0dff58d..b3d0221fedb 100644
--- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp
+++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
@@ -142,14 +142,14 @@ ConfigRetriever::getConfig() {
}
ndb_mgm_configuration *
-ConfigRetriever::getConfig(NdbMgmHandle m_handle){
-
+ConfigRetriever::getConfig(NdbMgmHandle m_handle)
+{
ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle,m_version);
- if(conf == 0){
+ if(conf == 0)
+ {
setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
return 0;
}
-
return conf;
}
diff --git a/ndb/src/common/transporter/Transporter.cpp b/ndb/src/common/transporter/Transporter.cpp
index 124ed5f7241..377fabe27ab 100644
--- a/ndb/src/common/transporter/Transporter.cpp
+++ b/ndb/src/common/transporter/Transporter.cpp
@@ -76,6 +76,7 @@ Transporter::Transporter(TransporterRegistry &t_reg,
m_connected = false;
m_timeOutMillis = 1000;
+ m_connect_address.s_addr= 0;
if(s_port<0)
s_port= -s_port; // was dynamic
@@ -103,6 +104,13 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
DBUG_RETURN(true); // TODO assert(0);
}
+ {
+ struct sockaddr addr;
+ SOCKET_SIZE_TYPE addrlen= sizeof(addr);
+ int r= getpeername(sockfd, &addr, &addrlen);
+ m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
+ }
+
bool res = connect_server_impl(sockfd);
if(res){
m_connected = true;
@@ -189,6 +197,13 @@ Transporter::connect_client(NDB_SOCKET_TYPE sockfd) {
g_eventLogger.warning("Unable to verify transporter compatability with node %d", nodeId);
}
+ {
+ struct sockaddr addr;
+ SOCKET_SIZE_TYPE addrlen= sizeof(addr);
+ int r= getpeername(sockfd, &addr, &addrlen);
+ m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
+ }
+
bool res = connect_client_impl(sockfd);
if(res){
m_connected = true;
diff --git a/ndb/src/common/transporter/Transporter.hpp b/ndb/src/common/transporter/Transporter.hpp
index 8c5e96226a3..c9f4e9bda42 100644
--- a/ndb/src/common/transporter/Transporter.hpp
+++ b/ndb/src/common/transporter/Transporter.hpp
@@ -147,6 +147,7 @@ private:
bool isMgmConnection;
SocketClient *m_socket_client;
+ struct in_addr m_connect_address;
protected:
Uint32 getErrorCount();
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index a9e93ee90e8..60649665d4a 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -55,6 +55,12 @@ extern int g_ndb_shm_signum;
#include <EventLogger.hpp>
extern EventLogger g_eventLogger;
+struct in_addr
+TransporterRegistry::get_connect_address(NodeId node_id) const
+{
+ return theTransporters[node_id]->m_connect_address;
+}
+
SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
{
DBUG_ENTER("SocketServer::Session * TransporterService::newSession");
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index b86adee16cc..51356cb75b1 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -2142,6 +2142,24 @@ MgmtSrvr::getNodeType(NodeId nodeId) const
return nodeTypes[nodeId];
}
+const char *MgmtSrvr::get_connect_address(Uint32 node_id)
+{
+ if (m_connect_address[node_id].s_addr == 0 &&
+ theFacade && theFacade->theTransporterRegistry &&
+ theFacade->theClusterMgr &&
+ getNodeType(node_id) == NDB_MGM_NODE_TYPE_NDB)
+ {
+ const ClusterMgr::Node &node=
+ theFacade->theClusterMgr->getNodeInfo(node_id);
+ if (node.connected)
+ {
+ m_connect_address[node_id]=
+ theFacade->theTransporterRegistry->get_connect_address(node_id);
+ }
+ }
+ return inet_ntoa(m_connect_address[node_id]);
+}
+
void
MgmtSrvr::get_connected_nodes(NodeBitmask &connected_nodes) const
{
diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp
index e0b9dabc4c9..b7983e6b441 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -520,7 +520,7 @@ public:
ConfigRetriever *get_config_retriever() { return m_config_retriever; };
- const char *get_connect_address(Uint32 node_id) { return inet_ntoa(m_connect_address[node_id]); }
+ const char *get_connect_address(Uint32 node_id);
void get_connected_nodes(NodeBitmask &connected_nodes) const;
SocketServer *get_socket_server() { return m_socket_server; }