Module: sip-router
Branch: ser_core_cvs
Commit: 0dc023ec75c4331492f7d845bc445deb00ac4d9d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0dc023e…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Apr 10 10:24:40 2009 +0000
tcp: stats: added init & destroy macros
---
tcp_main.c | 2 ++
tcp_stats.h | 22 +++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/tcp_main.c b/tcp_main.c
index 5e08810..6f7271a 100644
--- a/tcp_main.c
+++ b/tcp_main.c
@@ -3972,6 +3972,7 @@ void destroy_tcp()
shm_free(tcpconn_id_hash);
tcpconn_id_hash=0;
}
+ DESTROY_TCP_STATS();
if (tcp_connections_no){
shm_free(tcp_connections_no);
tcp_connections_no=0;
@@ -4032,6 +4033,7 @@ int init_tcp()
goto error;
}
*tcp_connections_no=0;
+ if (INIT_TCP_STATS()!=0) goto error;
connection_id=shm_malloc(sizeof(int));
if (connection_id==0){
LOG(L_CRIT, "ERROR: init_tcp: could not alloc globals\n");
diff --git a/tcp_stats.h b/tcp_stats.h
index 790518e..67c1ddc 100644
--- a/tcp_stats.h
+++ b/tcp_stats.h
@@ -27,6 +27,26 @@
#ifndef __tcp_stats_h
#define __tcp_stats_h
+#ifndef USE_TCP_STATS
+
+#define INIT_TCP_STATS() 0 /* success */
+#define DESTROY_TCP_STATS()
+
+#define TCP_STATS_ESTABLISHED(state)
+#define TCP_STATS_CONNECT_FAILED()
+#define TCP_STATS_LOCAL_REJECT()
+#define TCP_STATS_CON_TIMEOUT()
+#define TCP_STATS_CON_RESET()
+#define TCP_STATS_SEND_TIMEOUT()
+#define TCP_STATS_SENDQ_FULL()
+
+#else /* USE_TCP_STATS */
+
+#define INIT_TCP_STATS() 0 /* success */
+
+#define DESTROY_TCP_STATS()
+
+
/** called each time a new tcp connection is established.
* @param state - S_CONN_ACCEPT if it was the result of an accept()
* - S_CONN_CONNECT if it was the result of a connect()
@@ -65,7 +85,7 @@
*/
#define TCP_STATS_SENDQ_FULL()
-
+#endif /* USE_TCP_STATS */
#endif /*__tcp_stats_h*/