New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS-4399 TS-4400 Management API messes up proxy options #1073
Closed
Closed
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9f28180
TS-4399 TS-4400 Management API messes up proxy options
danobi 3365b20
Fix memory leaks
danobi 8203719
Centralize traffic_server entry point
danobi af59ccb
Remove callback between traffic_manager and LocalManager
danobi 79b2b70
Code cleanup
danobi 586b8ff
Fix CoreAPI sleeping deadlock
danobi 0fe5db3
clang-format
danobi 10c10af
Code cleanup
danobi 5a989cb
Remove ProxyStateSet sleeping
danobi 3619a85
Code formatting cleanup
danobi 9e09c30
Fix build warning
danobi File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -616,38 +616,27 @@ main(int argc, const char **argv) | |
RecLocalStart(configFiles); | ||
|
||
/* Update cmd line overrides/environmental overrides/etc */ | ||
if (tsArgs) { /* Passed command line args for proxy */ | ||
ats_free(lmgmt->proxy_options); | ||
lmgmt->proxy_options = tsArgs; | ||
mgmt_log("[main] Traffic Server Args: '%s'\n", lmgmt->proxy_options); | ||
} | ||
if (tsArgs) /* Passed command line args for proxy */ | ||
callback_proxy_options.push_back(ats_strdup(tsArgs)); | ||
|
||
// we must pass in bind_stdout and bind_stderr values to TS | ||
// we do it so TS is able to create BaseLogFiles for each value | ||
// we must give bind_stdout and bind_stderr values to callback_proxy_options | ||
// so LocalManager can start up TS with the correct options | ||
// | ||
// TS needs them to be able to create BaseLogFiles for each value | ||
if (*bind_stdout != 0) { | ||
callback_proxy_options.push_back(ats_strdup(TM_OPT_BIND_STDOUT)); | ||
char *bind_stdout_opt = new char[strlen("--") + strlen(TM_OPT_BIND_STDOUT)]; | ||
strcpy(bind_stdout_opt, "--"); | ||
strcat(bind_stdout_opt, TM_OPT_BIND_STDOUT); | ||
callback_proxy_options.push_back(bind_stdout_opt); | ||
callback_proxy_options.push_back(ats_strdup(bind_stdout)); | ||
|
||
size_t l = strlen(lmgmt->proxy_options); | ||
size_t n = 3 /* " --" */ | ||
+ sizeof(TM_OPT_BIND_STDOUT) /* nul accounted for here */ | ||
+ 1 /* space */ | ||
+ strlen(bind_stdout); | ||
lmgmt->proxy_options = static_cast<char *>(ats_realloc(lmgmt->proxy_options, n + l)); | ||
snprintf(lmgmt->proxy_options + l, n, " --%s %s", TM_OPT_BIND_STDOUT, bind_stdout); | ||
} | ||
|
||
if (*bind_stderr != 0) { | ||
callback_proxy_options.push_back(ats_strdup(TM_OPT_BIND_STDERR)); | ||
char *bind_stderr_opt = new char[strlen("--") + strlen(TM_OPT_BIND_STDERR)]; | ||
strcpy(bind_stderr_opt, "--"); | ||
strcat(bind_stderr_opt, TM_OPT_BIND_STDERR); | ||
callback_proxy_options.push_back(bind_stderr_opt); | ||
callback_proxy_options.push_back(ats_strdup(bind_stderr)); | ||
|
||
size_t l = strlen(lmgmt->proxy_options); | ||
size_t n = 3 /* space dash dash */ | ||
+ sizeof(TM_OPT_BIND_STDERR) /* nul accounted for here */ | ||
+ 1 /* space */ | ||
+ strlen(bind_stderr); | ||
lmgmt->proxy_options = static_cast<char *>(ats_realloc(lmgmt->proxy_options, n + l)); | ||
snprintf(lmgmt->proxy_options + l, n, " --%s %s", TM_OPT_BIND_STDERR, bind_stderr); | ||
} | ||
|
||
// If there exist proxy options we want CoreAPI to have, we set the callback | ||
|
@@ -835,10 +824,11 @@ main(int argc, const char **argv) | |
} else { | ||
sleep_time = 1; | ||
} | ||
if (lmgmt->startProxy()) { | ||
if (ProxyStateSet(TS_PROXY_ON, TS_CACHE_CLEAR_NONE) == TS_ERR_OKAY) { | ||
just_started = 0; | ||
sleep_time = 0; | ||
} else { | ||
mgmt_log("in ProxyStateSet else branch"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self: remove this line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes please :) |
||
just_started++; | ||
} | ||
} else { /* Give the proxy a chance to fire up */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.