From ab79b9b593cbde7064a7e4ad49867c36f969cadd Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 10 Aug 2011 06:11:39 +0200 Subject: m2ua: Print information about number of SCTP connections It appears that it is possible to have a stale SCTP connection and this added LOGL_NOTICE and the VTY interface might help to identify this situation in the future (the mean time of failure is about five month). --- src/sctp_m2ua.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/sctp_m2ua.c') diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c index 017f65e..cdcf8cf 100644 --- a/src/sctp_m2ua.c +++ b/src/sctp_m2ua.c @@ -32,6 +32,18 @@ #define SCTP_PPID_M2UA 2 + +int sctp_m2ua_conn_count(struct sctp_m2ua_transport *trans) +{ + int count = 0; + struct sctp_m2ua_conn *conn; + + llist_for_each_entry(conn, &trans->conns, entry) + count += 1; + + return count; +} + static struct mtp_m2ua_link *find_m2ua_link(struct sctp_m2ua_transport *trans, int link_index) { struct mtp_m2ua_link *link; @@ -650,7 +662,7 @@ static int sctp_trans_accept(struct osmo_fd *fd, unsigned int what) struct sctp_m2ua_conn *conn; struct sockaddr_in addr; socklen_t len; - int s, ret; + int s, ret, count; len = sizeof(addr); s = accept(fd->fd, (struct sockaddr *) &addr, &len); @@ -700,6 +712,10 @@ static int sctp_trans_accept(struct osmo_fd *fd, unsigned int what) } llist_add_tail(&conn->entry, &trans->conns); + + + count = sctp_m2ua_conn_count(trans); + LOGP(DINP, LOGL_NOTICE, "Now having %d SCTP connection(s).\n", count); return 0; } -- cgit v1.2.3