mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-12 06:35:04 +08:00
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:
@@ -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&) {
|
||||
|
||||
Reference in New Issue
Block a user