Skip to content

Commit

Permalink
feature: fixed compilation errors with nginx 1.9.1+. thanks Vadim A. …
Browse files Browse the repository at this point in the history
…Misbakh-Soloviov for the original patch in #38.
  • Loading branch information
agentzh committed Jul 4, 2015
1 parent 04e33d1 commit 7950a25
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ngx_postgres_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ void
ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
ngx_http_upstream_t *u, ngx_int_t rc)
{
#if defined(nginx_version) && (nginx_version < 1009001)
ngx_time_t *tp;
#endif

dd("entering");

Expand All @@ -61,10 +63,15 @@ ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
u->resolved->ctx = NULL;
}

#if defined(nginx_version) && (nginx_version >= 1009001)
if (u->state && u->state->response_time) {
u->state->response_time = ngx_current_msec - u->state->response_time;
#else
if (u->state && u->state->response_sec) {
tp = ngx_timeofday();
u->state->response_sec = tp->sec - u->state->response_sec;
u->state->response_msec = tp->msec - u->state->response_msec;
#endif

if (u->pipe) {
u->state->response_length = u->pipe->read_length;
Expand Down

0 comments on commit 7950a25

Please sign in to comment.