Commit 2f02008b authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb

into mysql.com:/home/jonas/src/mysql-4.1-ndb


ndb/src/mgmsrv/MgmtSrvr.cpp:
  Auto merged
parents a20efa65 6ea7adf5
......@@ -76,7 +76,7 @@ public:
* then close the socket
* Returns true if succeding in binding
*/
bool tryBind(unsigned short port, const char * intface = 0) const;
static bool tryBind(unsigned short port, const char * intface = 0);
/**
* Setup socket
......
......@@ -47,7 +47,7 @@ SocketServer::~SocketServer() {
}
bool
SocketServer::tryBind(unsigned short port, const char * intface) const {
SocketServer::tryBind(unsigned short port, const char * intface) {
struct sockaddr_in servaddr;
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
......
......@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <pthread.h>
#include <my_pthread.h>
#include "MgmtSrvr.hpp"
#include "MgmtErrorReporter.hpp"
......@@ -67,9 +67,10 @@ void *
MgmtSrvr::logLevelThread_C(void* m)
{
MgmtSrvr *mgm = (MgmtSrvr*)m;
my_thread_init();
mgm->logLevelThreadRun();
my_thread_end();
NdbThread_Exit(0);
/* NOTREACHED */
return 0;
......@@ -79,9 +80,10 @@ void *
MgmtSrvr::signalRecvThread_C(void *m)
{
MgmtSrvr *mgm = (MgmtSrvr*)m;
my_thread_init();
mgm->signalRecvThreadRun();
my_thread_end();
NdbThread_Exit(0);
/* NOTREACHED */
return 0;
......@@ -515,6 +517,9 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
_props = NULL;
_ownNodeId= 0;
NodeId tmp= nodeId;
BaseString error_string;
#if 0
char my_hostname[256];
struct sockaddr_in tmp_addr;
SOCKET_SIZE_TYPE addrlen= sizeof(tmp_addr);
......@@ -529,8 +534,6 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
exit(-1);
}
}
NodeId tmp= nodeId;
BaseString error_string;
if (!alloc_node_id(&tmp, NDB_MGM_NODE_TYPE_MGM,
(struct sockaddr *)&tmp_addr,
&addrlen, error_string)){
......@@ -538,6 +541,14 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
<< error_string.c_str() << endl;
exit(-1);
}
#else
if (!alloc_node_id(&tmp, NDB_MGM_NODE_TYPE_MGM,
0, 0, error_string)){
ndbout << "Unable to obtain requested nodeid: "
<< error_string.c_str() << endl;
exit(-1);
}
#endif
_ownNodeId = tmp;
......@@ -2190,7 +2201,12 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
continue;
}
// connecting through localhost
// check if config_hostname match hostname
// check if config_hostname is local
#if 1
if (!SocketServer::tryBind(0,config_hostname)) {
continue;
}
#else
char my_hostname[256];
if (gethostname(my_hostname, sizeof(my_hostname)) != 0)
continue;
......@@ -2199,6 +2215,11 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
// no match
continue;
}
#endif
}
} else { // client_addr == 0
if (!SocketServer::tryBind(0,config_hostname)) {
continue;
}
}
if (*nodeId != 0 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment