From 44f7b6a0c9017d6a82c803d5f216d8cf7c77002c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 28 May 2013 14:35:11 +0200 Subject: [PATCH] ywebserver: try to use port 8080 if port 80 is not available Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/860443c4e39d345ac84c4353024eea2c0b6672c1 Author: Stefan Seyfried Date: 2013-05-28 (Tue, 28 May 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/nhttpd/yhttpd_core/ywebserver.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/nhttpd/yhttpd_core/ywebserver.cpp b/src/nhttpd/yhttpd_core/ywebserver.cpp index eae380b95..c360b75ca 100644 --- a/src/nhttpd/yhttpd_core/ywebserver.cpp +++ b/src/nhttpd/yhttpd_core/ywebserver.cpp @@ -118,8 +118,16 @@ CWebserver::~CWebserver() { #define MAX_TIMEOUTS_TO_TEST 100 bool CWebserver::run(void) { if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) { - dperror("Socket cannot bind and listen. Abort.\n"); - return false; + if (port != 80) { + 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; + if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) { + fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", port); + return false; + } } #ifdef Y_CONFIG_FEATURE_KEEP_ALIVE