[asterisk-commits] res odbc: Show only when there a fail attempt of connection ... (asterisk[14])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 11 21:17:54 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: res_odbc: Show only when there a fail attempt of connection in CLI
......................................................................


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
---
M res/res_odbc.c
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified



diff --git a/res/res_odbc.c b/res/res_odbc.c
index bd64b9f..62faf98 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -668,10 +668,14 @@
 			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");
 		}

-- 
To view, visit https://gerrit.asterisk.org/3449
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c058b0be6f7642e922de75ee6b82c7276c9f113
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list