mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +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
|
#undef HTTPD_NAME
|
||||||
#define HTTPD_NAME "nhttpd"
|
#define HTTPD_NAME "nhttpd"
|
||||||
#define HTTPD_STANDARD_PORT 80
|
#define HTTPD_STANDARD_PORT 80
|
||||||
|
#define HTTPD_FALLBACK_PORT 8080
|
||||||
#define HTTPD_MAX_CONNECTIONS 50
|
#define HTTPD_MAX_CONNECTIONS 50
|
||||||
#define HTTPD_REQUEST_LOG "/tmp/httpd_log"
|
#define HTTPD_REQUEST_LOG "/tmp/httpd_log"
|
||||||
#define SSL_PEMFILE HTTPD_CONFIGDIR "/server.pem"
|
#define SSL_PEMFILE HTTPD_CONFIGDIR "/server.pem"
|
||||||
|
@@ -51,7 +51,7 @@ CWebserver::CWebserver() {
|
|||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
#endif
|
#endif
|
||||||
port = 80;
|
port = HTTPD_STANDARD_PORT;
|
||||||
|
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -118,14 +118,15 @@ CWebserver::~CWebserver() {
|
|||||||
bool CWebserver::run(void) {
|
bool CWebserver::run(void) {
|
||||||
set_threadname("ywebsrv::run");
|
set_threadname("ywebsrv::run");
|
||||||
if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) {
|
if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) {
|
||||||
if (port != 80) {
|
if (port != HTTPD_STANDARD_PORT) {
|
||||||
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", 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;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "[yhttpd] cannot bind and listen on port 80, retrying on port 8080.\n");
|
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d. Retrying port %d.\n", HTTPD_STANDARD_PORT, HTTPD_FALLBACK_PORT);
|
||||||
port = 8080;
|
port = HTTPD_FALLBACK_PORT;
|
||||||
if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user