summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsen Kirov <akirov@luxoft.com>2015-09-14 18:47:08 +0300
committerAsen Kirov <akirov@luxoft.com>2015-09-14 18:47:08 +0300
commit487bca81733bd5dd5586a9e62e80d31379d54763 (patch)
treead9564cbee5f7dfe75ffa4635e7e931e346901a6
parent12d569a8ae8f8822c3bba13c82f3667780d94250 (diff)
downloadsmartdevicelink-487bca81733bd5dd5586a9e62e80d31379d54763.tar.gz
Fix Logger's TelnetAppender socket reopen on fast restart
When SDL is stopped, TelnetAppender's server socket listening on port 6676 will remain in TIME_WAIT state (if there was a client connected to it) fr some time, depending on the operating system settings. With the old code, if we restart SDL soon after stopping it, TelnetApplender will fail to bind to its port, because 'it is in use'. The fix is to set SO_REUSEADDR option to server socket when opening it - this will allow the port to be reused when it is in TIME_WAIT state.
-rw-r--r--src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp
index 32e4f1a33..095fffc54 100644
--- a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp
+++ b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/serversocket.cpp
@@ -39,6 +39,12 @@ ServerSocket::ServerSocket(int port) : pool(), mutex(pool), socket(0), timeout(0
throw SocketException(status);
}
+ // AKirov: Added SO_REUSEADDR option to fix APPLINK-15273
+ status = apr_socket_opt_set(socket, APR_SO_REUSEADDR, 1);
+ if (status != APR_SUCCESS) {
+ throw SocketException(status);
+ }
+
// Create server socket address (including port number)
apr_sockaddr_t *server_addr;
status =