NS: Factor out gprs_nsvc_start_test() and use it
This function performs sending a NS-ALIVE PDU and starting Tns-Test,
let's use it in all places where we used to do that.
As part of this, also fix a bug where the sendto() return value (number
of bytes sent) would actually propagate up all the way to
gprs_ns_rx_reset() return value, which in turn affects the test results
on stdout.
Change-Id: I4d303117f77fabb74bbb91887b9914a81c2a084a
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 660dfec..ad68bc9 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1171,8 +1171,7 @@
rc = gprs_ns_tx_reset_ack(*nsvc);
/* start the test procedure */
- gprs_ns_tx_alive(*nsvc);
- nsvc_start_timer((*nsvc), NSVC_TIMER_TNS_TEST);
+ gprs_nsvc_start_test(*nsvc);
return rc;
}
@@ -1295,10 +1294,9 @@
osmo_timer_del(&(*nsvc)->timer);
}
/* Initiate TEST proc.: Send ALIVE and start timer */
- rc = gprs_ns_tx_alive(*nsvc);
- nsvc_start_timer(*nsvc, NSVC_TIMER_TNS_TEST);
+ gprs_nsvc_start_test(*nsvc);
- return rc;
+ return 0;
}
static int gprs_ns_rx_block(struct gprs_nsvc *nsvc, struct msgb *msg)
@@ -1949,4 +1947,11 @@
return s;
}
+/*! Start the ALIVE timer procedure in all NS-VCs part of this NS Instance */
+void gprs_nsvc_start_test(struct gprs_nsvc *nsvc)
+{
+ gprs_ns_tx_alive(nsvc);
+ nsvc_start_timer(nsvc, NSVC_TIMER_TNS_TEST);
+}
+
/*! @} */