From e948224d44bfc2f39feb231d8dee066399ef8e56 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 9 Oct 2015 14:43:12 +0200 Subject: [PATCH] m3ua: Start timer to wait for ASPAC_ACK For M3UA we should have one time-out for operation we want and then re-transmit it. As this is too much work right now create a single timer that waits that after a connect the ASPAC_ACK state will be reached. --- include/sctp_m3ua.h | 4 ++++ src/sctp_m3ua_client.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/sctp_m3ua.h b/include/sctp_m3ua.h index dfada73..9e7c267 100644 --- a/include/sctp_m3ua.h +++ b/include/sctp_m3ua.h @@ -28,6 +28,10 @@ struct mtp_m3ua_client_link { /* state of the link */ int aspsm_active; int asptm_active; + + /* reliability handling */ + struct osmo_timer_list aspac_ack_timer; + int aspac_ack_timeout; }; struct mtp_m3ua_client_link *mtp_m3ua_client_link_init(struct mtp_link *link); diff --git a/src/sctp_m3ua_client.c b/src/sctp_m3ua_client.c index dcc1610..01f2af7 100644 --- a/src/sctp_m3ua_client.c +++ b/src/sctp_m3ua_client.c @@ -69,6 +69,14 @@ static void fail_link(struct mtp_m3ua_client_link *link) schedule_restart(link); } +static void aspac_ack_timeout(void *data) +{ + struct mtp_m3ua_client_link *link = data; + + LOGP(DINP, LOGL_ERROR, "ASP ACK not received. Closing it down.\n"); + fail_link(link); +} + static int m3ua_conn_handle(struct mtp_m3ua_client_link *link, struct msgb *msg, struct sctp_sndrcvinfo *info) { @@ -233,6 +241,9 @@ static void m3ua_start(void *data) } /* begin the messages for bring-up */ + link->aspac_ack_timer.data = link; + link->aspac_ack_timer.cb = aspac_ack_timeout; + osmo_timer_schedule(&link->aspac_ack_timer, link->aspac_ack_timeout, 0); m3ua_send_aspup(link); } @@ -329,6 +340,7 @@ static int m3ua_shutdown(struct mtp_link *mtp_link) link->aspsm_active = 0; link->asptm_active = 0; osmo_timer_del(&link->connect_timer); + osmo_timer_del(&link->aspac_ack_timer); return 0; } @@ -375,6 +387,7 @@ struct mtp_m3ua_client_link *mtp_m3ua_client_link_init(struct mtp_link *blnk) osmo_wqueue_init(&lnk->queue, 10); lnk->queue.bfd.fd = -1; lnk->traffic_mode = 2; + lnk->aspac_ack_timeout = 10; return lnk; } @@ -490,6 +503,7 @@ static void m3ua_handle_asptm(struct mtp_m3ua_client_link *link, struct xua_msg switch (m3ua->hdr.msg_type) { case M3UA_ASPTM_ACTIV_ACK: LOGP(DINP, LOGL_NOTICE, "Received ASPAC_ACK.. taking link up\n"); + osmo_timer_del(&link->aspac_ack_timer); link->asptm_active = 1; mtp_link_up(link->base); m3ua_send_daud(link, link->base->set->dpc);