| 2770 | } |
| 2771 | |
| 2772 | static int updateTLSPort(long long val, long long prev, const char **err) { |
| 2773 | /* Do nothing if port is unchanged */ |
| 2774 | if (val == prev) { |
| 2775 | return 1; |
| 2776 | } |
| 2777 | |
| 2778 | /* Configure TLS if tls is enabled */ |
| 2779 | if (prev == 0 && tlsConfigure(&g_pserver->tls_ctx_config) == C_ERR) { |
| 2780 | *err = "Unable to update TLS configuration. Check server logs."; |
| 2781 | return 0; |
| 2782 | } |
| 2783 | |
| 2784 | // Do our thread first in case there is a config issue |
| 2785 | if (!updateTLSPortThread(val, true /*fFirstCall*/, err)) |
| 2786 | return 0; |
| 2787 | |
| 2788 | for (int ithread = 0; ithread < cserver.cthreads; ++ithread) { |
| 2789 | if (ithread == serverTL - g_pserver->rgthreadvar) |
| 2790 | continue; // we already did our thread |
| 2791 | aePostFunction(g_pserver->rgthreadvar[ithread].el, [val]{ |
| 2792 | const char **err = nullptr; |
| 2793 | if (!updateTLSPortThread(val, false /*fFirstCall*/, err)) { |
| 2794 | serverLog(LL_WARNING, "Failed to update TLS port for a thread: %s", *err); |
| 2795 | serverLog(LL_WARNING, "\tKeyDB will still be listening on the old port for some threads."); |
| 2796 | } |
| 2797 | }); |
| 2798 | } |
| 2799 | |
| 2800 | return 1; |
| 2801 | } |
| 2802 | |
| 2803 | #endif /* USE_OPENSSL */ |
| 2804 |
nothing calls this directly
no test coverage detected