summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch/Server.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-04-05 18:40:37 +0000
committerMarc Laukien <marc@zeroc.com>2002-04-05 18:40:37 +0000
commit86f6f01a19f122bfd47c0c2c6badc0f54de01250 (patch)
tree1267a4146a2ea8dd53e13014eb89ae0f81c77467 /cpp/src/IcePatch/Server.cpp
parentfixing ConcurrentModificationException in stopAll (diff)
downloadice-86f6f01a19f122bfd47c0c2c6badc0f54de01250.tar.bz2
ice-86f6f01a19f122bfd47c0c2c6badc0f54de01250.tar.xz
ice-86f6f01a19f122bfd47c0c2c6badc0f54de01250.zip
fixes for WIN32
Diffstat (limited to 'cpp/src/IcePatch/Server.cpp')
-rw-r--r--cpp/src/IcePatch/Server.cpp122
1 files changed, 59 insertions, 63 deletions
diff --git a/cpp/src/IcePatch/Server.cpp b/cpp/src/IcePatch/Server.cpp
index 371e72a9b0f..ae3070a7ddc 100644
--- a/cpp/src/IcePatch/Server.cpp
+++ b/cpp/src/IcePatch/Server.cpp
@@ -43,60 +43,69 @@ IcePatch::Server::usage()
int
IcePatch::Server::run(int argc, char* argv[])
{
- for (int i = 1; i < argc; ++i)
- {
- if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
- {
- usage();
- return EXIT_SUCCESS;
- }
- else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
- {
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
- }
- else
- {
- cerr << appName() << ": unknown option `" << argv[i] << "'" << endl;
- usage();
- return EXIT_FAILURE;
- }
- }
-
- PropertiesPtr properties = communicator()->getProperties();
-
- //
- // Get the working directory and change to this directory.
- //
- const char* directoryProperty = "IcePatch.Directory";
- string directory = properties->getProperty(directoryProperty);
- if (!directory.empty())
- {
- if (chdir(directory.c_str()) == -1)
- {
- cerr << appName() << ": can't change to directory `" << directory << "': " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
- }
-
- //
- // Get the IcePatch endpoints.
- //
- const char* endpointsProperty = "IcePatch.Endpoints";
- string endpoints = properties->getProperty(endpointsProperty);
- if (endpoints.empty())
- {
- cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl;
- return EXIT_FAILURE;
- }
-
- //
- // Create MD5 and BZ2 files.
- //
try
{
+ for (int i = 1; i < argc; ++i)
+ {
+ if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ {
+ usage();
+ return EXIT_SUCCESS;
+ }
+ else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else
+ {
+ cerr << appName() << ": unknown option `" << argv[i] << "'" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+ }
+
+ PropertiesPtr properties = communicator()->getProperties();
+
+ //
+ // Get the IcePatch endpoints.
+ //
+ const char* endpointsProperty = "IcePatch.Endpoints";
+ string endpoints = properties->getProperty(endpointsProperty);
+ if (endpoints.empty())
+ {
+ cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
+ }
+
+ //
+ // Get the working directory and change to this directory.
+ //
+ const char* directoryProperty = "IcePatch.Directory";
+ string directory = properties->getProperty(directoryProperty);
+ if (!directory.empty())
+ {
+ changeDirectory(directory);
+ }
+
+ //
+ // Create MD5 and BZ2 files.
+ //
createMD5Recursive(".");
createBZ2Recursive(".");
+
+ //
+ // Create and initialize the object adapter and the node locator.
+ //
+ ObjectAdapterPtr adapter = communicator()->createObjectAdapterFromProperty("IcePatch", endpointsProperty);
+ ServantLocatorPtr nodeLocator = new NodeLocator(adapter);
+ adapter->addServantLocator(nodeLocator, "IcePatch");
+ adapter->activate();
+
+ //
+ // We're done, let's wait for shutdown.
+ //
+ communicator()->waitForShutdown();
}
catch (const NodeAccessException& ex)
{
@@ -104,19 +113,6 @@ IcePatch::Server::run(int argc, char* argv[])
return EXIT_FAILURE;
}
- //
- // Create and initialize the object adapter and the node locator.
- //
- ObjectAdapterPtr adapter = communicator()->createObjectAdapterFromProperty("IcePatch", endpointsProperty);
- ServantLocatorPtr nodeLocator = new NodeLocator(adapter);
- adapter->addServantLocator(nodeLocator, "IcePatch");
- adapter->activate();
-
- //
- // We're done, let's wait for shutdown.
- //
- communicator()->waitForShutdown();
-
return EXIT_SUCCESS;
}