ExitCode main(ServiceContext* serviceContext) { serviceContext->setFastClockSource(FastClockSourceFactory::create(Milliseconds{10})); auto const shardingContext = Grid::get(serviceContext); // We either have a setting where all processes are in localhost or none are std::vector<HostAndPort> configServers = mongosGlobalParams.configdbs.getServers(); for (std::vector<HostAndPort>::const_iterator it = configServers.begin(); it != configServers.end(); ++it) { const HostAndPort& configAddr = *it; if (it == configServers.begin()) { shardingContext->setAllowLocalHost(configAddr.isLocalHost()); } if (configAddr.isLocalHost() != shardingContext->allowLocalHost()) { log(LogComponent::kDefault) << "cannot mix localhost and ip addresses in configdbs"; return EXIT_BADOPTIONS; } } #if defined(_WIN32) if (ntservice::shouldStartService()) { ntservice::startService(); // If we reach here, then we are not running as a service. Service installation exits // directly and so never reaches here either. } #endif return runMongosServer(serviceContext); }
static void initService() { ntservice::reportStatus( SERVICE_RUNNING ); log() << "Service running" << endl; runMongosServer( false ); }
bool initService() { ServiceController::reportStatus( SERVICE_RUNNING ); log() << "Service running" << endl; runMongosServer( false ); return true; }
ExitCode initService() { return runMongosServer(getGlobalServiceContext()); }