diff options
author | Rodrigo Ramírez Norambuena <a@rodrigoramirez.com> | 2016-08-06 02:37:35 -0400 |
---|---|---|
committer | Rodrigo Ramírez Norambuena <a@rodrigoramirez.com> | 2016-08-06 02:39:18 -0400 |
commit | 0749f6e6f3b39288309c546d547a1b09c9eef685 (patch) | |
tree | ef03a436cb1a89b662998bdae8497d449999be63 | |
parent | e711e57106369fabfe46eefb43f7c30134ffa4e9 (diff) |
res_odbc: Show only when there a fail attempt of connection in CLI
When is executed CLI command "odbc show all" every time is show
information about variable last_negative_connect. If not there a fail
attempt of connection will show date like "1969-12-31 21:00:00".
This patch fix there situation for to show only this information when
exists a fail attempt before.
Change-Id: I7c058b0be6f7642e922de75ee6b82c7276c9f113
-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"); } |