static lcb_error_t connect_next(http_provider *http) { char *errinfo = NULL; lcb_error_t err; lcb_conn_params params; lcb_connection_t conn = &http->connection; close_current(http); reset_stream_state(http); params.handler = connect_done_handler; params.timeout = PROVIDER_SETTING(&http->base, config_node_timeout); lcb_log(LOGARGS(http, TRACE), "Starting HTTP Configuration Provider %p", http); err = lcb_connection_cycle_nodes(conn, http->nodes, ¶ms, &errinfo); if (err == LCB_SUCCESS) { err = setup_request_header(http); } else { lcb_log(LOGARGS(http, ERROR), "%p: Couldn't schedule connection (0x%x)", http, err); } return err; }
/** * Call when there is an error in I/O. This includes read, write, connect * and timeouts. */ static lcb_error_t io_error(http_provider *http) { lcb_error_t err; lcb_conn_params params; char *errinfo; close_current(http); params.timeout = PROVIDER_SETTING(&http->base, config_node_timeout); params.handler = connect_done_handler; err = lcb_connection_next_node(&http->connection, http->nodes, ¶ms, &errinfo); if (err != LCB_SUCCESS) { lcb_confmon_provider_failed(&http->base, err); lcb_timer_disarm(http->io_timer); return err; } else { setup_request_header(http); } return LCB_SUCCESS; }
/** * Call when there is an error in I/O. This includes read, write, connect * and timeouts. */ static lcb_error_t io_error(http_provider *http, lcb_error_t origerr) { lcb_error_t err; lcb_conn_params params; char *errinfo; int can_retry = 0; close_current(http); params.timeout = PROVIDER_SETTING(&http->base, config_node_timeout); params.handler = connect_done_handler; if (http->base.parent->config) { can_retry = 1; } else if (origerr != LCB_AUTH_ERROR && origerr != LCB_BUCKET_ENOENT) { can_retry = 1; } if (can_retry) { err = lcb_connection_next_node( &http->connection, http->nodes, ¶ms, &errinfo); } else { err = origerr; } if (err != LCB_SUCCESS) { lcb_confmon_provider_failed(&http->base, origerr); lcb_timer_disarm(http->io_timer); if (is_v220_compat(http)) { lcb_log(LOGARGS(http, INFO), "HTTP node list finished. Looping again (disconn_tmo=-1)"); connect_next(http); } return origerr; } else { setup_request_header(http); } return LCB_SUCCESS; }