mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
- nhttpd: use PORT-defines from yconfig.h instead of "hardcoded" ports
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -88,6 +88,7 @@
|
||||
#undef HTTPD_NAME
|
||||
#define HTTPD_NAME "nhttpd"
|
||||
#define HTTPD_STANDARD_PORT 80
|
||||
#define HTTPD_FALLBACK_PORT 8080
|
||||
#define HTTPD_MAX_CONNECTIONS 50
|
||||
#define HTTPD_REQUEST_LOG "/tmp/httpd_log"
|
||||
#define SSL_PEMFILE HTTPD_CONFIGDIR "/server.pem"
|
||||
|
@@ -51,7 +51,7 @@ CWebserver::CWebserver() {
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
#endif
|
||||
port = 80;
|
||||
port = HTTPD_STANDARD_PORT;
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -118,14 +118,15 @@ CWebserver::~CWebserver() {
|
||||
bool CWebserver::run(void) {
|
||||
set_threadname("ywebsrv::run");
|
||||
if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) {
|
||||
if (port != 80) {
|
||||
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", port);
|
||||
if (port != HTTPD_STANDARD_PORT) {
|
||||
// WebsiteMain.port in nhttpd.conf is changed by user
|
||||
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d. Abort.\n", port);
|
||||
return false;
|
||||
}
|
||||
fprintf(stderr, "[yhttpd] cannot bind and listen on port 80, retrying on port 8080.\n");
|
||||
port = 8080;
|
||||
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d. Retrying port %d.\n", HTTPD_STANDARD_PORT, HTTPD_FALLBACK_PORT);
|
||||
port = HTTPD_FALLBACK_PORT;
|
||||
if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) {
|
||||
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", port);
|
||||
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d. Abort.\n", HTTPD_FALLBACK_PORT);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user