diff --git a/include/proxysql_glovars.hpp b/include/proxysql_glovars.hpp index a79760c3d..7dfa7301e 100644 --- a/include/proxysql_glovars.hpp +++ b/include/proxysql_glovars.hpp @@ -62,6 +62,7 @@ class ProxySQL_GlobalVariables { bool gdbg; bool nostart; bool monitor; + bool version_check; #ifdef SO_REUSEPORT bool reuseport; #endif /* SO_REUSEPORT */ diff --git a/include/proxysql_structs.h b/include/proxysql_structs.h index 78884e22c..9d1869439 100644 --- a/include/proxysql_structs.h +++ b/include/proxysql_structs.h @@ -506,6 +506,7 @@ struct _global_variables_t { bool has_debug; bool idle_threads; + bool version_check; volatile int shutdown; bool nostart; diff --git a/lib/ProxySQL_GloVars.cpp b/lib/ProxySQL_GloVars.cpp index db06f64fa..ea7a02948 100644 --- a/lib/ProxySQL_GloVars.cpp +++ b/lib/ProxySQL_GloVars.cpp @@ -60,7 +60,7 @@ ProxySQL_GlobalVariables::ProxySQL_GlobalVariables() { statuses.stack_memory_admin_threads = 0; statuses.stack_memory_cluster_threads = 0; - + global.version_check = true; global.gdbg=false; global.nostart=false; global.foreground=false; @@ -114,6 +114,7 @@ ProxySQL_GlobalVariables::ProxySQL_GlobalVariables() { #ifdef IDLE_THREADS opt->add((const char *)"",0,0,0,(const char *)"Create auxiliary threads to handle idle connections",(const char *)"--idle-threads"); #endif /* IDLE_THREADS */ + opt->add((const char *)"",0,0,0,(const char *)"Do not check for the latest version of ProxySQL",(const char *)"--no-version-check"); opt->add((const char *)"",0,1,0,(const char *)"Administration Unix Socket",(const char *)"-S",(const char *)"--admin-socket"); opt->add((const char *)"",0,0,0,(const char *)"Enable SQLite3 Server",(const char *)"--sqlite3-server"); @@ -188,6 +189,10 @@ void ProxySQL_GlobalVariables::process_opts_pre() { } #endif /* IDLE_THREADS */ + if (opt->isSet("--no-version-check")) { + global.version_check=false; + glovars.version_check=false; + } if (opt->isSet("--sqlite3-server")) { global.sqlite3_server=true; } diff --git a/src/main.cpp b/src/main.cpp index d8b399fc0..8756fa918 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1680,8 +1680,7 @@ __start_label: #endif } - //if (GloVars.check_for_new_version) { - if (0) { + if (GloVars.global.version_check) { pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);