diff --git a/src/sa.c b/src/sa.c index 25997c3..c1729b0 100644 --- a/src/sa.c +++ b/src/sa.c @@ -203,9 +203,12 @@ void *sa_service(void *fc) { int rv = 0; + int sleep_ms = 100; + int mk_saem_n_sleep = 0; + while (!facilities->exit) { - if (bulletin->to_provide_len) { + if (bulletin->to_provide_len && sleep_ms*mk_saem_n_sleep >= 1000) { rv = mk_saem(facilities, bdr->data.buf, (uint32_t *) &bdr->data.size); if (!rv) { asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_TransportDataRequest, NULL, tdr, tdr_oer+1, 1023); @@ -217,6 +220,7 @@ void *sa_service(void *fc) { pthread_cond_signal(&facilities->tx_queue->trigger); } } + mk_saem_n_sleep = 0; } pthread_mutex_lock(&bulletin->lock); @@ -256,7 +260,7 @@ void *sa_service(void *fc) { } pthread_mutex_unlock(&bulletin->lock); - usleep(100000); + usleep(sleep_ms*1000); } ASN_STRUCT_FREE(asn_DEF_TransportDataRequest, tdr);