b/f: have subscriptions protected until SUBSCRIBE sent

this prevents corruption in the (extremely rare) case that a reply
to SUBSCRIBE or a NOTIFY is already processed while the method to
send the SUBSCRIBE is still being processed (with the little overhead
of a bit more lock contention)
sayer/1.4-spce2.6
Stefan Sayer 15 years ago
parent 492f3df1db
commit 06c3534e27

@ -60,18 +60,16 @@ string _AmSipSubscriptionContainer::createSubscription(const AmSipSubscriptionIn
subscriptions_mut.lock();
subscriptions[handle] = new_sub;
subscriptions_mut.unlock();
AmEventDispatcher::instance()->addEventQueue(handle, this);
if (!new_sub->doSubscribe()) {
DBG("subscribe failed - removing subscription\b");
AmEventDispatcher::instance()->delEventQueue(handle);
subscriptions_mut.lock();
subscriptions.erase(handle);
subscriptions_mut.unlock();
delete new_sub;
return "";
}
subscriptions_mut.unlock();
return handle;
}

Loading…
Cancel
Save