Skip to content
Snippets Groups Projects
Commit d151f858 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

get master or slave status from client (not related to port number anymore)

git-svn-id: http://root.cern.ch/svn/root/trunk@104 27541ba8-7e3a-0410-8455-c3a389f83636
parent c9c8e753
No related branches found
No related tags found
No related merge requests found
// @(#)root/proofd:$Name: $:$Id: proofd.cxx,v 1.1.1.1 2000/05/16 17:00:48 rdm Exp $
// @(#)root/proofd:$Name: $:$Id: proofd.cxx,v 1.2 2000/05/23 15:10:58 brun Exp $
// Author: Fons Rademakers 02/02/97
/*************************************************************************
......@@ -304,15 +304,16 @@ char *reroute_user(char *confdir, char *user_name)
int main(int /* argc */, char **argv)
{
// Arguments for master: "proofserv" confdir
// Arguments for slave : "proofslave" confdir
// Arguments: <confdir>
// Confdir is the location where the PROOF config files and binaries live.
char *argvv[4];
char arg0[256];
char *user_name;
char *node_name;
char vtag[80];
char msg[80];
int master;
//
// Make this process the process group leader and disassociate from
......@@ -323,12 +324,16 @@ int main(int /* argc */, char **argv)
if (fork() != 0) exit(0); // parent exits
setsid();
// find out if we are supposed to be a master or a slave server
if (Recv(msg, sizeof(msg)) < 0)
fatal_error("Cannot receive master/slave status");
master = !strcmp("master", msg) ? 1 : 0;
// user authentication
user_name = check_pass();
// only reroute in case of master server
if (!strcmp("proofserv", argv[0]) &&
(node_name = reroute_user(argv[1], user_name)) != 0) {
if (master && (node_name = reroute_user(argv[0], user_name)) != 0) {
// send a reroute request to the client passing the IP address
char host_name[32];
......@@ -369,13 +374,13 @@ int main(int /* argc */, char **argv)
fatal_error("Error receiving version tag");
// start server version
sprintf(arg0, "%s/bin/proofserv.%s", argv[1], vtag);
sprintf(arg0, "%s/bin/proofserv.%s", argv[0], vtag);
argvv[0] = arg0;
argvv[1] = argv[0];
argvv[2] = argv[1];
argvv[1] = master ? "proofserv" : "proofslave";
argvv[2] = argv[0];
argvv[3] = 0;
#if defined(__linux)
sprintf(msg, "LD_LIBRARY_PATH=%s/lib", argv[1]);
sprintf(msg, "LD_LIBRARY_PATH=%s/lib", argv[0]);
putenv(msg);
#endif
execv(arg0, argvv);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment