diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c index 9201fda..8b145a3 100644 --- a/mbuni/mmlib/mms_queue.c +++ b/mbuni/mmlib/mms_queue.c @@ -703,7 +703,7 @@ Octstr *mms_queue_add(Octstr *from, List *to, e->from = xfrom; e->created = time(NULL); e->sendt = senddate; - e->expiryt = expirydate; + e->expiryt = expirydate ? expirydate : time(NULL) + DEFAULT_EXPIRE; e->lasttry = 0; e->attempts = 0; e->lastaccess = 0; diff --git a/mbuni/mmsc/mmsmobilesender.c b/mbuni/mmsc/mmsmobilesender.c index b731285..d5b180a 100644 --- a/mbuni/mmsc/mmsmobilesender.c +++ b/mbuni/mmsc/mmsmobilesender.c @@ -30,7 +30,14 @@ static MmsEnvelope *update_env_success(MmsEnvelope *env, MmsEnvelopeTo *xto) else { env->lasttry = tnow; env->attempts++; - env->sendt = env->lasttry + settings->send_back_off * env->attempts; + + /* If max send attempts has been reached, set next try to expiry time, otherwise + * use normal back-off procedure + */ + if (env->attempts >= settings->maxsendattempts) + env->sendt = env->expiryt; + else + env->sendt = env->lasttry + settings->send_back_off * env->attempts; } if (mms_queue_update(env) == 1)