Module: sip-router
Branch: kamailio_3.0
Commit: a1264e11d3fa77f841ff541ac7fb73956316183e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a1264e1…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Aug 18 18:36:14 2010 +0200
tcp: fix double increment for the established stats
The counter/stats for established TCP connections were incremented
twice in the case of accept()-ed connections: once immediately
after the accept() and another time after the first packet
received or sent on the connection.
Now they are incremented only after the first successful send or
receive.
(cherry picked from commit 66cda7bc5f642ce892124cfb35f1e5effd78e9d6)
---
tcp_main.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/tcp_main.c b/tcp_main.c
index 255753d..2258bc3 100644
--- a/tcp_main.c
+++ b/tcp_main.c
@@ -3499,7 +3499,15 @@ static inline int handle_new_connect(struct socket_info* si)
return 1; /* success, because the accept was succesfull */
}
(*tcp_connections_no)++;
- TCP_STATS_ESTABLISHED(S_CONN_ACCEPT);
+ /* stats for established connections are incremented after
+ the first received or sent packet.
+ Alternatively they could be incremented here for accepted
+ connections, but then the connection state must be changed to
+ S_CONN_OK:
+ TCP_STATS_ESTABLISHED(S_CONN_ACCEPT);
+ ...
+ tcpconn=tcpconn_new(new_sock, &su, dst_su, si, si->proto, S_CONN_OK);
+ */
dst_su=&si->su;
if (unlikely(si->flags & SI_IS_ANY)){