added command line and configuration file arguments to choose

the address and port to listen on or connect to.  changed the
default port and put it in ProtocolTypes.h.  the HTTP port is
now no longer opened unless the --http argument is supplied
or the config file includes it.
This commit is contained in:
crs
2002-06-09 16:53:25 +00:00
parent 8b2a282eb5
commit 555aa19eb2
14 changed files with 376 additions and 62 deletions

View File

@@ -83,13 +83,15 @@ void CServer::run()
}
}
// start listening for HTTP requests
m_httpServer = new CHTTPServer(this);
CThread(new TMethodJob<CServer>(this, &CServer::acceptHTTPClients));
// start listening for new clients
CThread(new TMethodJob<CServer>(this, &CServer::acceptClients));
// start listening for HTTP requests
if (m_config.getHTTPAddress().isValid()) {
m_httpServer = new CHTTPServer(this);
CThread(new TMethodJob<CServer>(this, &CServer::acceptHTTPClients));
}
// handle events
log((CLOG_DEBUG "starting event handling"));
m_primary->run();
@@ -982,11 +984,10 @@ void CServer::acceptClients(void*)
// bind to the desired port. keep retrying if we can't bind
// the address immediately.
CStopwatch timer;
CNetworkAddress addr(50001 /* FIXME -- m_port */);
for (;;) {
try {
log((CLOG_DEBUG1 "binding listen socket"));
listen->bind(addr);
listen->bind(m_config.getSynergyAddress());
break;
}
catch (XSocketAddressInUse&) {
@@ -1166,11 +1167,10 @@ void CServer::acceptHTTPClients(void*)
// bind to the desired port. keep retrying if we can't bind
// the address immediately.
CStopwatch timer;
CNetworkAddress addr(50002 /* FIXME -- m_httpPort */);
for (;;) {
try {
log((CLOG_DEBUG1 "binding listen socket"));
listen->bind(addr);
log((CLOG_DEBUG1 "binding HTTP listen socket"));
listen->bind(m_config.getHTTPAddress());
break;
}
catch (XSocketAddressInUse&) {