Navigation Menu

Skip to content

Commit

Permalink
Remove unnecessary records API defines
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeach committed Feb 14, 2014
1 parent 178c7b9 commit 30ceedb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 52 deletions.
46 changes: 23 additions & 23 deletions proxy/Main.cc
Expand Up @@ -357,7 +357,7 @@ cmd_list(char * /* cmd ATS_UNUSED */)
// show hostdb size

int h_size = 120000;
TS_ReadConfigInteger(h_size, "proxy.config.hostdb.size");
REC_ReadConfigInteger(h_size, "proxy.config.hostdb.size");
printf("Host Database size:\t%d\n", h_size);

// show cache config information....
Expand Down Expand Up @@ -692,7 +692,7 @@ static void
check_fd_limit()
{
int fds_throttle = -1;
TS_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
REC_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
if (fds_throttle > fds_limit + THROTTLE_FD_HEADROOM) {
int new_fds_throttle = fds_limit - THROTTLE_FD_HEADROOM;
if (new_fds_throttle < 1)
Expand Down Expand Up @@ -782,7 +782,7 @@ init_core_size()
RecData rec_temp;
rec_temp.rec_int = coreSize;
set_core_size(NULL, RECD_INT, rec_temp, NULL);
found = (TS_RegisterConfigUpdateFunc("proxy.config.core_limit", set_core_size, NULL) == REC_ERR_OKAY);
found = (REC_RegisterConfigUpdateFunc("proxy.config.core_limit", set_core_size, NULL) == REC_ERR_OKAY);

ink_assert(found);
}
Expand All @@ -797,11 +797,11 @@ adjust_sys_settings(void)
int fds_throttle = -1;

// TODO: I think we might be able to get rid of this?
TS_ReadConfigInteger(mmap_max, "proxy.config.system.mmap_max");
REC_ReadConfigInteger(mmap_max, "proxy.config.system.mmap_max");
if (mmap_max >= 0)
ats_mallopt(ATS_MMAP_MAX, mmap_max);

TS_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
REC_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");

if (!getrlimit(RLIMIT_NOFILE, &lim)) {
if (fds_throttle > (int) (lim.rlim_cur + THROTTLE_FD_HEADROOM)) {
Expand Down Expand Up @@ -974,7 +974,7 @@ syslog_log_configure()
char *facility_str = NULL;
int facility;

TS_ReadConfigStringAlloc(facility_str, "proxy.config.syslog_facility");
REC_ReadConfigStringAlloc(facility_str, "proxy.config.syslog_facility");

if (facility_str == NULL || (facility = facility_string_to_int(facility_str)) < 0) {
syslog(LOG_WARNING, "Bad or missing syslog facility. " "Defaulting to LOG_DAEMON");
Expand Down Expand Up @@ -1092,14 +1092,14 @@ getNumSSLThreads(void)
if (HttpProxyPort::hasSSL()) {
int config_num_ssl_threads = 0;

TS_ReadConfigInteger(config_num_ssl_threads, "proxy.config.ssl.number.threads");
REC_ReadConfigInteger(config_num_ssl_threads, "proxy.config.ssl.number.threads");

if (config_num_ssl_threads != 0) {
num_of_ssl_threads = config_num_ssl_threads;
} else {
float autoconfig_scale = 1.5;

TS_ReadConfigFloat(autoconfig_scale, "proxy.config.exec_thread.autoconfig.scale");
REC_ReadConfigFloat(autoconfig_scale, "proxy.config.exec_thread.autoconfig.scale");
num_of_ssl_threads = (int)((float)ink_number_of_processors() * autoconfig_scale);

// Last resort
Expand All @@ -1118,13 +1118,13 @@ adjust_num_of_net_threads(int nthreads)
int nth_auto_config = 1;
int num_of_threads_tmp = 1;

TS_ReadConfigInteger(nth_auto_config, "proxy.config.exec_thread.autoconfig");
REC_ReadConfigInteger(nth_auto_config, "proxy.config.exec_thread.autoconfig");

Debug("threads", "initial number of net threads is %d", nthreads);
Debug("threads", "net threads auto-configuration %s", nth_auto_config ? "enabled" : "disabled");

if (!nth_auto_config) {
TS_ReadConfigInteger(num_of_threads_tmp, "proxy.config.exec_thread.limit");
REC_ReadConfigInteger(num_of_threads_tmp, "proxy.config.exec_thread.limit");

if (num_of_threads_tmp <= 0) {
num_of_threads_tmp = 1;
Expand All @@ -1135,7 +1135,7 @@ adjust_num_of_net_threads(int nthreads)
nthreads = num_of_threads_tmp;
} else { /* autoconfig is enabled */
num_of_threads_tmp = nthreads;
TS_ReadConfigFloat(autoconfig_scale, "proxy.config.exec_thread.autoconfig.scale");
REC_ReadConfigFloat(autoconfig_scale, "proxy.config.exec_thread.autoconfig.scale");
num_of_threads_tmp = (int) ((float) num_of_threads_tmp * autoconfig_scale);

if (num_of_threads_tmp) {
Expand Down Expand Up @@ -1315,15 +1315,15 @@ main(int /* argc ATS_UNUSED */, char **argv)
syslog_log_configure();

if (!num_accept_threads)
TS_ReadConfigInteger(num_accept_threads, "proxy.config.accept_threads");
REC_ReadConfigInteger(num_accept_threads, "proxy.config.accept_threads");

if (!num_task_threads)
TS_ReadConfigInteger(num_task_threads, "proxy.config.task_threads");
REC_ReadConfigInteger(num_task_threads, "proxy.config.task_threads");

xptr<char> user(MAX_LOGIN + 1);

*user = '\0';
admin_user_p = ((REC_ERR_OKAY == TS_ReadConfigString(user, "proxy.config.admin.user_id", MAX_LOGIN)) &&
admin_user_p = ((REC_ERR_OKAY == REC_ReadConfigString(user, "proxy.config.admin.user_id", MAX_LOGIN)) &&
(*user != '\0') && (0 != strcmp(user, "#-1")));

# if TS_USE_POSIX_CAP
Expand Down Expand Up @@ -1368,7 +1368,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
// Check if we should do mlockall()
#if defined(MCL_FUTURE)
int mlock_flags = 0;
TS_ReadConfigInteger(mlock_flags, "proxy.config.mlock_enabled");
REC_ReadConfigInteger(mlock_flags, "proxy.config.mlock_enabled");

if (mlock_flags == 2) {
if (0 != mlockall(MCL_CURRENT | MCL_FUTURE))
Expand Down Expand Up @@ -1407,7 +1407,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
// pmgmt->start() must occur after initialization of Diags but
// before calling RecProcessInit()

TS_ReadConfigInteger(res_track_memory, "proxy.config.res_track_memory");
REC_ReadConfigInteger(res_track_memory, "proxy.config.res_track_memory");

init_http_header();

Expand Down Expand Up @@ -1480,7 +1480,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
eventProcessor.start(num_of_net_threads, stacksize);

int num_remap_threads = 0;
TS_ReadConfigInteger(num_remap_threads, "proxy.config.remap.num_remap_threads");
REC_ReadConfigInteger(num_remap_threads, "proxy.config.remap.num_remap_threads");
if (num_remap_threads < 1)
num_remap_threads = 0;

Expand Down Expand Up @@ -1518,7 +1518,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
HttpProxyPort::loadDefaultIfEmpty();

if (!accept_mss)
TS_ReadConfigInteger(accept_mss, "proxy.config.net.sock_mss_in");
REC_ReadConfigInteger(accept_mss, "proxy.config.net.sock_mss_in");

NetProcessor::accept_mss = accept_mss;
netProcessor.start(0, stacksize);
Expand All @@ -1542,7 +1542,7 @@ main(int /* argc ATS_UNUSED */, char **argv)

// UDP net-threads are turned off by default.
if (!num_of_udp_threads)
TS_ReadConfigInteger(num_of_udp_threads, "proxy.config.udp.threads");
REC_ReadConfigInteger(num_of_udp_threads, "proxy.config.udp.threads");
if (num_of_udp_threads)
udpNet.start(num_of_udp_threads, stacksize);

Expand Down Expand Up @@ -1582,11 +1582,11 @@ main(int /* argc ATS_UNUSED */, char **argv)
init_HttpProxyServer(num_accept_threads);

int http_enabled = 1;
TS_ReadConfigInteger(http_enabled, "proxy.config.http.enabled");
REC_ReadConfigInteger(http_enabled, "proxy.config.http.enabled");

if (http_enabled) {
int icp_enabled = 0;
TS_ReadConfigInteger(icp_enabled, "proxy.config.icp.enabled");
REC_ReadConfigInteger(icp_enabled, "proxy.config.icp.enabled");

// call the ready hooks before we start accepting connections.
APIHook* hook = lifecycle_hooks->get(TS_LIFECYCLE_PORTS_INITIALIZED_HOOK);
Expand All @@ -1596,7 +1596,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
}

int delay_p = 0;
TS_ReadConfigInteger(delay_p, "proxy.config.http.wait_for_cache");
REC_ReadConfigInteger(delay_p, "proxy.config.http.wait_for_cache");

// Delay only if config value set and flag value is zero
// (-1 => cache already initialized)
Expand All @@ -1613,7 +1613,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
tasksProcessor.start(num_task_threads, stacksize);

int back_door_port = NO_FD;
TS_ReadConfigInteger(back_door_port, "proxy.config.process_manager.mgmt_port");
REC_ReadConfigInteger(back_door_port, "proxy.config.process_manager.mgmt_port");
if (back_door_port != NO_FD)
start_HttpProxyServerBackDoor(back_door_port, num_accept_threads > 0 ? 1 : 0); // One accept thread is enough

Expand Down
10 changes: 0 additions & 10 deletions proxy/Main.h
Expand Up @@ -80,14 +80,4 @@ maintainance_mode()
extern const Version version;
extern AppVersionInfo appVersionInfo;

#define TS_ReadConfigInteger REC_ReadConfigInteger
#define TS_ReadConfigFloat REC_ReadConfigFloat
#define TS_ReadConfigString REC_ReadConfigString
#define TS_EstablishStaticConfigInteger REC_EstablishStaticConfigInteger
#define TS_RegisterConfigUpdateFunc REC_RegisterConfigUpdateFunc
#define TS_ReadConfigStringAlloc REC_ReadConfigStringAlloc
#define TS_ConfigReadInteger REC_ConfigReadInteger
#define TS_ConfigReadString REC_ConfigReadString


#endif /* _Main_h_ */
22 changes: 11 additions & 11 deletions proxy/Prefetch.cc
Expand Up @@ -1909,33 +1909,33 @@ PrefetchConfiguration::readConfiguration()
int fd = -1;

local_http_server_port = stuffer_port = 0;
prefetch_enabled = TS_ConfigReadInteger("proxy.config.prefetch.prefetch_enabled");
prefetch_enabled = REC_ConfigReadInteger("proxy.config.prefetch.prefetch_enabled");
if (prefetch_enabled <= 0) {
prefetch_enabled = 0;
return 0;
}

local_http_server_port = HttpProxyPort::findHttp(AF_INET)->m_port;
TS_ReadConfigInteger(stuffer_port, "proxy.config.prefetch.child_port");
TS_ReadConfigInteger(url_buffer_size, "proxy.config.prefetch.url_buffer_size");
TS_ReadConfigInteger(url_buffer_timeout, "proxy.config.prefetch.url_buffer_timeout");
TS_ReadConfigInteger(keepalive_timeout, "proxy.config.prefetch.keepalive_timeout");
REC_ReadConfigInteger(stuffer_port, "proxy.config.prefetch.child_port");
REC_ReadConfigInteger(url_buffer_size, "proxy.config.prefetch.url_buffer_size");
REC_ReadConfigInteger(url_buffer_timeout, "proxy.config.prefetch.url_buffer_timeout");
REC_ReadConfigInteger(keepalive_timeout, "proxy.config.prefetch.keepalive_timeout");
if (keepalive_timeout <= 0)
keepalive_timeout = 3600;

TS_ReadConfigInteger(push_cached_objects, "proxy.config.prefetch.push_cached_objects");
REC_ReadConfigInteger(push_cached_objects, "proxy.config.prefetch.push_cached_objects");

TS_ReadConfigInteger(max_object_size, "proxy.config.prefetch.max_object_size");
REC_ReadConfigInteger(max_object_size, "proxy.config.prefetch.max_object_size");

TS_ReadConfigInteger(max_recursion, "proxy.config.prefetch.max_recursion");
REC_ReadConfigInteger(max_recursion, "proxy.config.prefetch.max_recursion");

TS_ReadConfigInteger(redirection, "proxy.config.prefetch.redirection");
REC_ReadConfigInteger(redirection, "proxy.config.prefetch.redirection");

char *tstr = TS_ConfigReadString("proxy.config.prefetch.default_url_proto");
char *tstr = REC_ConfigReadString("proxy.config.prefetch.default_url_proto");
if (config_read_proto(default_url_blast, tstr))
goto Lerror;

tstr = TS_ConfigReadString("proxy.config.prefetch.default_data_proto");
tstr = REC_ConfigReadString("proxy.config.prefetch.default_data_proto");
if (config_read_proto(default_data_blast, tstr))
goto Lerror;

Expand Down
8 changes: 0 additions & 8 deletions proxy/Prefetch.h
Expand Up @@ -433,14 +433,6 @@ class KeepAliveLockHandler: public Continuation
};


#define TS_ReadConfigInteger REC_ReadConfigInteger
#define TS_ReadConfigString REC_ReadConfigString
#define TS_EstablishStaticConfigInteger REC_EstablishStaticConfigInteger
#define TS_RegisterConfigUpdateFunc REC_RegisterConfigUpdateFunc
#define TS_ReadConfigStringAlloc REC_ReadConfigStringAlloc
#define TS_ConfigReadInteger REC_ConfigReadInteger
#define TS_ConfigReadString REC_ConfigReadString

#define PREFETCH_CONFIG_UPDATE_TIMEOUT (HRTIME_SECOND*60)

#endif // PREFETCH
Expand Down

0 comments on commit 30ceedb

Please sign in to comment.