diff options
author | zuul <zuul@gerrit.asterisk.org> | 2016-08-11 21:04:35 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-08-11 21:04:35 -0500 |
commit | 88e90db6599fd9cbe47e643044806b65e64f1115 (patch) | |
tree | af571eae6d688909c3a7408b8e058c347aa37627 | |
parent | f12a0350a06601d06a8de6cc602a3ec762f82b66 (diff) | |
parent | 0749f6e6f3b39288309c546d547a1b09c9eef685 (diff) |
Merge "res_odbc: Show only when there a fail attempt of connection in CLI"
-rw-r--r-- | res/res_odbc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c index bd64b9fef..62faf98b2 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -668,10 +668,14 @@ static char *handle_cli_odbc_show(struct ast_cli_entry *e, int cmd, struct ast_c char timestr[80]; struct ast_tm tm; - ast_localtime(&class->last_negative_connect, &tm, NULL); - ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %T", &tm); ast_cli(a->fd, " Name: %s\n DSN: %s\n", class->name, class->dsn); - ast_cli(a->fd, " Last connection attempt: %s\n", timestr); + + if (class->last_negative_connect.tv_sec > 0) { + ast_localtime(&class->last_negative_connect, &tm, NULL); + ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %T", &tm); + ast_cli(a->fd, " Last fail connection attempt: %s\n", timestr); + } + ast_cli(a->fd, " Number of active connections: %zd (out of %d)\n", class->connection_cnt, class->maxconnections); ast_cli(a->fd, "\n"); } |