////////////////////////////////////////////////////////////////////////// We don't have any specific "instances" here, at least not yet.
| 608 | // We don't have any specific "instances" here, at least not yet. |
| 609 | // |
| 610 | TSReturnCode |
| 611 | TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf */, int /* errbuf_size */) |
| 612 | { |
| 613 | TSCont cont = TSContCreate(cont_handle_response, nullptr); |
| 614 | BgFetchConfig *config = new BgFetchConfig(cont); |
| 615 | bool success = true; |
| 616 | |
| 617 | // The first two arguments are the "from" and "to" URL string. We need to |
| 618 | // skip them, but we also require that there be an option to masquerade as |
| 619 | // argv[0], so we increment the argument indexes by 1 rather than by 2. |
| 620 | argc--; |
| 621 | argv++; |
| 622 | |
| 623 | // This is for backwards compatibility, ugly! ToDo: Remove for ATS v9.0.0 IMO. |
| 624 | if (argc > 1 && *argv[1] != '-') { |
| 625 | Dbg(Bg_dbg_ctl, "config file %s", argv[1]); |
| 626 | if (!config->readConfig(argv[1])) { |
| 627 | success = false; |
| 628 | } |
| 629 | } else { |
| 630 | if (config->parseOptions(argc, const_cast<const char **>(argv))) { |
| 631 | // Create the global log file. Remember, the BgFetchState is a singleton. |
| 632 | if (config->logFile().size()) { |
| 633 | BgFetchState::getInstance().createLog(config->logFile()); |
| 634 | } |
| 635 | } else { |
| 636 | success = false; |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | if (success) { |
| 641 | *ih = config; |
| 642 | |
| 643 | return TS_SUCCESS; |
| 644 | } |
| 645 | |
| 646 | // Something went wrong with the configuration setup. |
| 647 | delete config; |
| 648 | return TS_ERROR; |
| 649 | } |
| 650 | |
| 651 | void |
| 652 | TSRemapDeleteInstance(void *ih) |
nothing calls this directly
no test coverage detected