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.
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 @@
/* 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 @@
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 @@
}
/* 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 @@
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 @@
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 @@
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);