mirror of https://gerrit.osmocom.org/libosmocore
gprs-ns/test: Add expire_nsvc_timer
This function forces the expiration of the timer within struct gprs_nsvc. It is meant to be used for controlled (and faster) timer expiration in unit tests. The timer_mode of the expired timer is returned (or -1 if the timer wasn't active). Sponsored-by: On-Waves ehf
This commit is contained in:
parent
2381fded68
commit
f1bcbb0f8a
|
@ -451,6 +451,21 @@ static void gprs_dump_nsi(struct gprs_ns_inst *nsi)
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
static int expire_nsvc_timer(struct gprs_nsvc *nsvc)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!osmo_timer_pending(&nsvc->timer))
|
||||
return -1;
|
||||
|
||||
rc = nsvc->timer_mode;
|
||||
osmo_timer_del(&nsvc->timer);
|
||||
|
||||
nsvc->timer.cb(nsvc->timer.data);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void test_nsvc()
|
||||
{
|
||||
struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL);
|
||||
|
|
Loading…
Reference in New Issue