diff --git a/src/shrpx_client_handler.cc b/src/shrpx_client_handler.cc index 25f2f0b6..750acee1 100644 --- a/src/shrpx_client_handler.cc +++ b/src/shrpx_client_handler.cc @@ -1171,7 +1171,7 @@ ClientHandler::get_downstream_connection(int &err, Downstream *downstream) { } dconn = - make_unique(group, -1, conn_.loop, worker_); + make_unique(group, 0, conn_.loop, worker_); } dconn->set_client_handler(this); diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 3b26ef72..4fdcb643 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -182,7 +182,7 @@ void connectcb(struct ev_loop *loop, ev_io *w, int revents) { } // namespace HttpDownstreamConnection::HttpDownstreamConnection( - const std::shared_ptr &group, ssize_t initial_addr_idx, + const std::shared_ptr &group, size_t initial_addr_idx, struct ev_loop *loop, Worker *worker) : conn_(loop, -1, nullptr, worker->get_mcpool(), worker->get_downstream_config()->timeout.write, diff --git a/src/shrpx_http_downstream_connection.h b/src/shrpx_http_downstream_connection.h index 94178858..baea026c 100644 --- a/src/shrpx_http_downstream_connection.h +++ b/src/shrpx_http_downstream_connection.h @@ -44,7 +44,7 @@ struct DNSQuery; class HttpDownstreamConnection : public DownstreamConnection { public: HttpDownstreamConnection(const std::shared_ptr &group, - ssize_t initial_addr_idx, struct ev_loop *loop, + size_t initial_addr_idx, struct ev_loop *loop, Worker *worker); virtual ~HttpDownstreamConnection(); virtual int attach_downstream(Downstream *downstream); @@ -109,9 +109,8 @@ private: IOControl ioctrl_; http_parser response_htp_; // Index to backend address. If client affinity is enabled, it is - // the index to affinity_hash. Otherwise, it is the index to the - // backend addresses. - ssize_t initial_addr_idx_; + // the index to affinity_hash. Otherwise, it is 0, and not used. + size_t initial_addr_idx_; // true if first write of reused connection succeeded. For // convenience, this is initialized as true. bool reuse_first_write_done_;