[ https://issues.apache.org/jira/browse/TS-4972?focusedWorklogId=30651&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-30651 ]
ASF GitHub Bot logged work on TS-4972: -------------------------------------- Author: ASF GitHub Bot Created on: 14/Oct/16 17:08 Start Date: 14/Oct/16 17:08 Worklog Time Spent: 10m Work Description: Github user jpeach commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/1111#discussion_r83462452 --- Diff: plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc --- @@ -265,49 +307,69 @@ collapsed_cont(TSCont contp, TSEvent event, void *edata) return TS_SUCCESS; } -TSReturnCode -TSRemapInit(TSRemapInterface * /* api_info */, char * /* errbuf */, int /* errbuf_size */) -{ - TSDebug(DEBUG_TAG, "plugin is succesfully initialized"); - return TS_SUCCESS; -} - -TSReturnCode -TSRemapNewInstance(int argc, char *argv[], void ** /* ih */, char * /* errbuf */, int /* errbuf_size */) +void +process_args(int argc, const char **argv) { // basic argv processing.. - for (int i = 2; i < argc; ++i) { + for (int i = 1; i < argc; ++i) { if (strncmp(argv[i], "--delay=", 8) == 0) { OPEN_WRITE_FAIL_REQ_DELAY_TIMEOUT = atoi((char *)(argv[i] + 8)); } else if (strncmp(argv[i], "--retries=", 10) == 0) { OPEN_WRITE_FAIL_MAX_REQ_DELAY_RETRIES = atoi((char *)(argv[i] + 10)); } } - - return TS_SUCCESS; } -TSRemapStatus -TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri) +/* + * Initialize globally + */ +void +TSPluginInit(int argc, const char *argv[]) { + TSPluginRegistrationInfo info; + + info.plugin_name = (char *)DEBUG_TAG; + info.vendor_name = (char *)"Apache Software Foundation"; + info.support_email = (char *)"d...@trafficserver.apache.org"; + + if (TS_SUCCESS != TSPluginRegister(&info)) { + TSError("[%s] Plugin registration failed.", DEBUG_TAG); + } + + process_args(argc, argv); + TSCont cont = TSContCreate(collapsed_cont, TSMutexCreate()); - RequestData *req_data = new RequestData(); + TSDebug(DEBUG_TAG, "Global Initialized"); + // Set up the per transaction state in the READ_REQUEST event + TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, cont); - req_data->txnp = rh; - req_data->wl_retry = 0; + global_init = true; --- End diff -- It seems like the only reason I can't have this as a global and a transaction plugin is the config is in globals. What do you think about moving that into an instance config for the remap case? Issue Time Tracking ------------------- Worklog Id: (was: 30651) Time Spent: 40m (was: 0.5h) > Allow collapsed_forwarding plugin to be configured global or per remap > ---------------------------------------------------------------------- > > Key: TS-4972 > URL: https://issues.apache.org/jira/browse/TS-4972 > Project: Traffic Server > Issue Type: Improvement > Components: Plugins > Reporter: Susan Hinrichs > Assignee: Susan Hinrichs > Time Spent: 40m > Remaining Estimate: 0h > > Currently collpased_forwarding plugin can only be configured on remap rules. > It would be convenient to just configure it globally for some environments. -- This message was sent by Atlassian JIRA (v6.3.4#6332)