songmonit / sipml5

Automatically exported from code.google.com/p/sipml5
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

tsip_transac_layer.prototype.cancel_by_dialog incorrectly deletes transactions when there is more than one transaction #208

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problem shows only during processing several calls.
My case: 1 incoming(not picked up), 1 outcoming(not picked up) 
         -> 1st hangs up(deleting last transac) 
         -> 2nd cant be hanged up properly(there is no 'terminated' event)

Cause:
tsip_transac_layer.prototype.cancel_by_dialog = function (o_dialog) {
    if (!o_dialog) {
        tsk_utils_log_error("Invalid argument");
        return -1;
    }

    var o_transac = null;

    while (this.b_locked){}

    this.b_locked = true;

    for (var i = 0; i < this.ao_transacs.length; ++i) {
        o_transac = this.ao_transacs[i];
        if (o_dialog.compare(o_transac.get_dialog()) == 0) {
            // async call to avoid dealoc
            setTimeout(function () {<< Always deletes last transac, because of o_transac is not in closure
               o_transac.fsm_act(tsip_action_type_e.CANCEL, null); }, 1);
        }
    }

    this.b_locked = false;

    return 0;
};

It is a typical error, so you should know how to fix it.

Original issue reported on code.google.com by Each.nir...@gmail.com on 2 Feb 2015 at 10:37

GoogleCodeExporter commented 9 years ago
Oh, duplicate of #173

Original comment by Each.nir...@gmail.com on 2 Feb 2015 at 10:39

GoogleCodeExporter commented 9 years ago

Original comment by boss...@yahoo.fr on 18 Mar 2015 at 9:03