Skip to content

Commit

Permalink
director: Fix logging last input/output time when there was no input/…
Browse files Browse the repository at this point in the history
…output
  • Loading branch information
sirainen authored and villesavolainen committed Jun 19, 2017
1 parent 8ad704f commit 3a92a3b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/director/director-connection.c
Expand Up @@ -166,11 +166,16 @@ director_connection_append_stats(struct director_connection *conn, string_t *str
int output_msecs = timeval_diff_msecs(&ioloop_timeval, &conn->last_output);
int connected_msecs = timeval_diff_msecs(&ioloop_timeval, &conn->connected_time);

str_printfa(str, "bytes in=%"PRIuUOFF_T", bytes out=%"PRIuUOFF_T", "
"last input %u.%03u s ago, last output %u.%03u s ago",
conn->input->v_offset, conn->output->offset,
input_msecs/1000, input_msecs%1000,
output_msecs/1000, output_msecs%1000);
str_printfa(str, "bytes in=%"PRIuUOFF_T", bytes out=%"PRIuUOFF_T,
conn->input->v_offset, conn->output->offset);
if (conn->last_input.tv_sec > 0) {
str_printfa(str, ", last input %u.%03u s ago",
input_msecs/1000, input_msecs%1000);
}
if (conn->last_output.tv_sec > 0) {
str_printfa(str, ", last output %u.%03u s ago",
output_msecs/1000, output_msecs%1000);
}
if (conn->connected) {
str_printfa(str, ", connected %u.%03u s ago",
connected_msecs/1000, connected_msecs%1000);
Expand Down

0 comments on commit 3a92a3b

Please sign in to comment.