SolidWallOfCode commented on a change in pull request #6931:
URL: https://github.com/apache/trafficserver/pull/6931#discussion_r444428892
##########
File path: src/traffic_server/traffic_server.cc
##########
@@ -2094,7 +2116,11 @@ main(int /* argc ATS_UNUSED */, const char **argv)
if (delay_p && ink_atomic_cas(&delay_listen_for_cache_p, 0, 1)) {
Debug("http_listen", "Delaying listen, waiting for cache
initialization");
} else {
+ // Since the previous delay_listen_for_cache_p was not 0, then the
+ // cache must have been initialized already.
Review comment:
"or ATS is not waiting for the cache to make the ports ready"
##########
File path: src/traffic_server/traffic_server.cc
##########
@@ -173,10 +174,23 @@ static int poll_timeout = -1; // No value set.
static int cmd_disable_freelist = 0;
static bool signal_received[NSIG];
-// 1: delay listen, wait for cache.
-// 0: Do not delay, start listen ASAP.
+/// We use the following two variables to gate the emission of the "traffic
+/// server initialized" log message. This message can be helpful for users who
+/// want to know that Traffic Server is not just running but has had its cache
+/// initialized and has called accept() on its ports.
+
+/// The sockets are not only created, but traffic server has set our socket
+/// options on them, plugins have configured them as desired, and traffic
+/// server has called accept on them.
+static std::atomic<bool> ports_are_ready = false;
+
+/// Cache initialization has completed.
+static std::atomic<bool> cache_is_initialized = false;
+
+// 1: the main thread delayed accepting, start accepting.
+// 0: delay accept, wait for cache initialization.
// -1: cache is already initialized, don't delay.
-static int delay_listen_for_cache_p;
+static int delay_listen_for_cache_p = 0;
Review comment:
Should take the "_p" suffix off, it's not a `bool`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]