diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-08-10 06:11:39 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-08-10 06:37:35 +0200 |
commit | ab79b9b593cbde7064a7e4ad49867c36f969cadd (patch) | |
tree | 8008fb085fd3eb90294a89508095c813b609f83a /src/sctp_m2ua.c | |
parent | c21c0d699f522ed38958cb9b19043efeaec03828 (diff) |
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).
Diffstat (limited to 'src/sctp_m2ua.c')
-rw-r--r-- | src/sctp_m2ua.c | 18 |
1 files changed, 17 insertions, 1 deletions
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; } |