summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-01-26 22:20:40 +0000
committerMarc Laukien <marc@zeroc.com>2002-01-26 22:20:40 +0000
commit54f96da3f4a968dbfa99c4b277b3d4dd7d08aca0 (patch)
treef789d201738fa9f50335a9fc71fe1a81bfac1773 /cpp/src
parentstarted glacier starter (diff)
downloadice-54f96da3f4a968dbfa99c4b277b3d4dd7d08aca0.tar.bz2
ice-54f96da3f4a968dbfa99c4b277b3d4dd7d08aca0.tar.xz
ice-54f96da3f4a968dbfa99c4b277b3d4dd7d08aca0.zip
more glacier starter
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier/GlacierRouter.cpp28
-rw-r--r--cpp/src/Glacier/GlacierStarter.cpp3
-rw-r--r--cpp/src/Glacier/Makefile7
-rw-r--r--cpp/src/Ice/PropertiesI.cpp13
-rw-r--r--cpp/src/Ice/PropertiesI.h1
-rw-r--r--cpp/src/IcePack/Activator.cpp2
6 files changed, 47 insertions, 7 deletions
diff --git a/cpp/src/Glacier/GlacierRouter.cpp b/cpp/src/Glacier/GlacierRouter.cpp
index 28435a3b86e..0bff2e2ea77 100644
--- a/cpp/src/Glacier/GlacierRouter.cpp
+++ b/cpp/src/Glacier/GlacierRouter.cpp
@@ -180,7 +180,7 @@ Glacier::Router::run(int argc, char* argv[])
string routerIdentity = properties->getProperty(routerIdentityProperty);
if (routerIdentity.empty())
{
- routerIdentity = "router";
+ routerIdentity = "Glacier#router";
}
ObjectAdapterPtr routerAdapter =
@@ -189,11 +189,33 @@ Glacier::Router::run(int argc, char* argv[])
routerAdapter->add(router, stringToIdentity(routerIdentity));
routerAdapter->activate();
+#ifndef WIN32
+ //
+ // Print the stringified router proxy on a filedescriptor
+ // specified in the properties, if so requested.
+ //
+ string outputFd = properties->getProperty("Glacier.Router.PrintProxyOnFd");
+ if (!outputFd.empty())
+ {
+ int fd = atoi(outputFd.c_str());
+ string ref = communicator()->proxyToString(routerAdapter->createProxy(stringToIdentity(routerIdentity)));
+ ref += "\n";
+ string::size_type sz = static_cast<string::size_type>(write(fd, ref.c_str(), ref.length()));
+ if (sz != ref.length())
+ {
+ cerr << appName() << ": cannot write stringified router proxy to filedescriptor " << fd << ": "
+ << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+
+ close(fd);
+ }
+#endif
+
//
// We're done, let's wait for shutdown.
//
communicator()->waitForShutdown();
- return EXIT_SUCCESS;
//
// Destroy the router. The client and server blobjects get
@@ -202,6 +224,8 @@ Glacier::Router::run(int argc, char* argv[])
RouterI* rtr = dynamic_cast<RouterI*>(router.get());
assert(rtr);
rtr->destroy();
+
+ return EXIT_SUCCESS;
}
int
diff --git a/cpp/src/Glacier/GlacierStarter.cpp b/cpp/src/Glacier/GlacierStarter.cpp
index a063b6ade8b..ddc9a00ef3a 100644
--- a/cpp/src/Glacier/GlacierStarter.cpp
+++ b/cpp/src/Glacier/GlacierStarter.cpp
@@ -9,6 +9,7 @@
// **********************************************************************
#include <Ice/Application.h>
+#include <Glacier/GlacierI.h>
using namespace std;
using namespace Ice;
@@ -76,6 +77,8 @@ Glacier::Router::run(int argc, char* argv[])
ObjectAdapterPtr starterAdapter = communicator()->createObjectAdapterFromProperty("Starter",
starterEndpointsProperty);
+ StarterPtr starter = new StarterI;
+ starterAdapter->add(starter, stringToIdentity("Glacier#starter"));
starterAdapter->activate();
//
diff --git a/cpp/src/Glacier/Makefile b/cpp/src/Glacier/Makefile
index fc4e4f68526..c8b4e3b92ef 100644
--- a/cpp/src/Glacier/Makefile
+++ b/cpp/src/Glacier/Makefile
@@ -19,7 +19,7 @@ VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE)
ROUTER = $(top_srcdir)/bin/glacier
STARTER = $(top_srcdir)/bin/glacierstarter
-TARGETS = $(NAME) $(VERSIONED_NAME) $(ROUTER) $(STARTER)
+TARGETS = $(NAME) $(VERSIONED_NAME) $(ROUTER) #$(STARTER)
OBJS = Glacier.o
@@ -28,7 +28,8 @@ ROBJS = GlacierRouter.o \
ClientBlobject.o \
ServerBlobject.o
-SOBJS = GlacierStarter.o
+SOBJS = GlacierStarter.o \
+ GlacierI.o
SRCS = $(OBJS:.o=.cpp) \
$(ROBJS:.o=.cpp) \
@@ -56,7 +57,7 @@ $(ROUTER): $(ROBJS)
$(STARTER): $(SOBJS)
rm -f $@
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(SOBJS) $(LIBS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(SOBJS) -lGlacier $(LIBS)
$(HDIR)/Glacier.h Glacier.cpp: $(SDIR)/Glacier.ice $(SLICE2CPP)
rm -f $(HDIR)/Glacier.h Glacier.cpp
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 156278b92ab..06e13051d4e 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -38,6 +38,19 @@ Ice::PropertiesI::setProperty(const string& key, const string& value)
_properties[key] = value;
}
+StringSeq
+Ice::PropertiesI::getCommandLineOptions()
+{
+ StringSeq result;
+ result.reserve(_properties.size());
+ map<string, string>::const_iterator p;
+ for (p = _properties.begin(); p != _properties.end(); ++p)
+ {
+ result.push_back("--" + p->first + "=" + p->second);
+ }
+ return result;
+}
+
PropertiesPtr
Ice::PropertiesI::clone()
{
diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h
index 255f7f0fb46..2d01fe55a2f 100644
--- a/cpp/src/Ice/PropertiesI.h
+++ b/cpp/src/Ice/PropertiesI.h
@@ -23,6 +23,7 @@ public:
virtual std::string getProperty(const std::string&);
virtual void setProperty(const std::string&, const std::string&);
+ virtual StringSeq getCommandLineOptions();
virtual PropertiesPtr clone();
static void addArgumentPrefix(const std::string&);
diff --git a/cpp/src/IcePack/Activator.cpp b/cpp/src/IcePack/Activator.cpp
index 34bc371e519..c16b82e186a 100644
--- a/cpp/src/IcePack/Activator.cpp
+++ b/cpp/src/IcePack/Activator.cpp
@@ -136,8 +136,6 @@ IcePack::Activator::activate(const ServerDescription& desc)
}
if (pid == 0) // Child process
{
- close(fds[0]);
-
//
// Close all filedescriptors, except for standard input,
// standard output, standard error output, and the write side