src/ngx_url_async_fetcher.cc
// Create the pool for fetcher, create the pipe, add the read event for main
// thread. It should be called in the worker process.
Create the pool for fetcher, create the pipe, add the read event for main
thread. It should be called in the worker process.
Create the pool for fetcher create the pipe add the read event for main thread . It should be called in the worker process .
bool NgxUrlAsyncFetcher::Init(ngx_cycle_t* cycle) {
    log_ = cycle->log;
    CHECK(event_connection_ == NULL) << "event connection already set";
    event_connection_ = new NgxEventConnection(ReadCallback);
    if (!event_connection_->Init(cycle)) {
      return false;
    }
    if (pool_ == NULL) {
      pool_ = ngx_create_pool(4096, log_);
      if (pool_ == NULL) {
        ngx_log_error(NGX_LOG_ERR, log_, 0,
            "NgxUrlAsyncFetcher::Init create pool failed");
        return false;
      }
    }
    if (proxy_.url.len == 0) {
      return true;
    }
    if (!ParseUrl(&proxy_, pool_)) {
      ngx_log_error(NGX_LOG_ERR, log_, 0,
          "NgxUrlAsyncFetcher::Init parse proxy[%V] failed", &proxy_.url);
      return false;
    }
    return true;
  }
bool NgxUrlAsyncFetcher :: Init ( ngx_cycle_t * cycle ) { log_ = cycle -> log ; CHECK ( event_connection_ == NULL ) << " " ; event_connection_ = new NgxEventConnection ( ReadCallback ) ; if ( ! event_connection_ -> Init ( cycle ) ) { return false ; } if ( pool_ == NULL ) { pool_ = ngx_create_pool ( 4096 , log_ ) ; if ( pool_ == NULL ) { ngx_log_error ( NGX_LOG_ERR , log_ , 0 , " " ) ; return false ; } } if ( proxy_ . url . len == 0 ) { return true ; } if ( ! ParseUrl ( & proxy_ , pool_ ) ) { ngx_log_error ( NGX_LOG_ERR , log_ , 0 , " " , & proxy_ . url ) ; return false ; } return true ; }
Create the pool for fetcher, create the pipe, add the read event for main
thread.
Create the pool for fetcher create the pipe add the read event for main thread .
// TODO(oschaaf): shouldn't we do this earlier? Do we need to clean // up when parsing the url failed?