From 70f12c4407a454f80e1cfd0e42100a0f057221e8 Mon Sep 17 00:00:00 2001 From: Unbit Date: Wed, 30 Jan 2013 14:06:09 +0100 Subject: [PATCH] fixed backlog reporting on 32bit --- core/master.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/core/master.c b/core/master.c index 362d2a55..fe758c6a 100644 --- a/core/master.c +++ b/core/master.c @@ -312,29 +312,28 @@ int uwsgi_get_tcp_info(int fd) { } #if defined(__linux__) - uwsgi.shared->load = uwsgi.shared->ti.tcpi_unacked; - uwsgi.shared->max_load = uwsgi.shared->ti.tcpi_sacked; + uwsgi.shared->load = (uint64_t) uwsgi.shared->ti.tcpi_unacked; + uwsgi.shared->max_load = (uint64_t) uwsgi.shared->ti.tcpi_sacked; #elif defined(__FreeBSD__) - uwsgi.shared->load = uwsgi.shared->ti.__tcpi_unacked; - uwsgi.shared->max_load = uwsgi.shared->ti.__tcpi_sacked; + uwsgi.shared->load = (uint64_t) uwsgi.shared->ti.__tcpi_unacked; + uwsgi.shared->max_load = (uint64_t) uwsgi.shared->ti.__tcpi_sacked; #endif - uwsgi.shared->options[UWSGI_OPTION_BACKLOG_STATUS] = uwsgi.shared->load; if (uwsgi.vassal_sos_backlog > 0 && uwsgi.has_emperor) { - if ((int) uwsgi.shared->load >= uwsgi.vassal_sos_backlog) { + if (uwsgi.shared->load >= (uint64_t) uwsgi.vassal_sos_backlog) { // ask emperor for help char byte = 30; if (write(uwsgi.emperor_fd, &byte, 1) != 1) { uwsgi_error("write()"); } else { - uwsgi_log("asking emperor for reinforcements (backlog: %d)...\n", (int) uwsgi.shared->load); + uwsgi_log("asking emperor for reinforcements (backlog: %llu)...\n", (unsigned long long ) uwsgi.shared->load); } } } if (uwsgi.shared->load >= uwsgi.shared->max_load) { - uwsgi_log_verbose("*** uWSGI listen queue of socket %d full !!! (%d/%d) ***\n", fd, uwsgi.shared->load, uwsgi.shared->max_load); + uwsgi_log_verbose("*** uWSGI listen queue of socket %d full !!! (%llu/%llu) ***\n", fd, (unsigned long long ) uwsgi.shared->load, (unsigned long long ) uwsgi.shared->max_load); uwsgi.shared->options[UWSGI_OPTION_BACKLOG_ERRORS]++; }