Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
1ed75f56
Commit
1ed75f56
authored
Jun 30, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added flexibility for connecting and retrieving config from mgmtsrvr
parent
426b2ac2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
14 deletions
+27
-14
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+27
-14
No files found.
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
1ed75f56
...
...
@@ -2324,25 +2324,38 @@ MgmtSrvr::getFreeNodeId(NodeId * nodeId, enum ndb_mgm_node_type type,
const
char
*
config_hostname
=
0
;
if
(
iter
.
get
(
CFG_NODE_HOST
,
&
config_hostname
))
abort
();
// getsockname(int s, struct sockaddr *name, socklen_t *namelen);
if
(
config_hostname
&&
config_hostname
[
0
]
!=
0
&&
client_addr
)
{
// check hostname compatability
struct
in_addr
config_addr
;
if
(
Ndb_getInAddr
(
&
config_addr
,
config_hostname
)
!=
0
||
memcmp
(
&
config_addr
,
&
(((
sockaddr_in
*
)
client_addr
)
->
sin_addr
),
sizeof
(
config_addr
))
!=
0
)
{
if
(
config_hostname
&&
config_hostname
[
0
]
!=
0
&&
client_addr
)
{
// check hostname compatability
struct
in_addr
config_addr
;
const
void
*
tmp
=
&
(((
sockaddr_in
*
)
client_addr
)
->
sin_addr
);
if
(
Ndb_getInAddr
(
&
config_addr
,
config_hostname
)
!=
0
||
memcmp
(
&
config_addr
,
tmp
,
sizeof
(
config_addr
))
!=
0
)
{
struct
in_addr
tmp_addr
;
if
(
Ndb_getInAddr
(
&
tmp_addr
,
"localhost"
)
!=
0
||
memcmp
(
&
tmp_addr
,
tmp
,
sizeof
(
config_addr
))
!=
0
)
{
// not localhost
#if 0
ndbout << "MgmtSrvr::getFreeNodeId compare failed for \"" << config_hostname
<< "\" id=" << tmp << endl;
ndbout << "MgmtSrvr::getFreeNodeId compare failed for \"" << config_hostname
<< "\" id=" << tmp << endl;
#endif
continue
;
}
continue
;
}
// connecting through localhost
// check if config_hostname match hostname
char
my_hostname
[
256
];
if
(
gethostname
(
my_hostname
,
sizeof
(
my_hostname
))
!=
0
)
continue
;
if
(
Ndb_getInAddr
(
&
tmp_addr
,
my_hostname
)
!=
0
||
memcmp
(
&
tmp_addr
,
&
config_addr
,
sizeof
(
config_addr
))
!=
0
)
{
// no match
continue
;
}
}
}
*
nodeId
=
tmp
;
#if 0
ndbout << "MgmtSrvr::getFreeNodeId found type=" << type
<< " *nodeid=" << *nodeId << endl;
ndbout << "MgmtSrvr::getFreeNodeId found type=" << type
<< " *nodeid=" << *nodeId << endl;
#endif
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment