jstp / node-jstp

JSTP implementation in Node.js
2 stars 2 forks source link

Unbinding the transactionIDs, the list does not get updated #16

Closed xaviervia closed 10 years ago

xaviervia commented 11 years ago

The code

  _unbindTransactionID: function (transactionID) {
    // Build the RELEASE
    var release = new Dispatch({
      method: "RELEASE",
      endpoint: {
        method: "ANSWER",
        resource: ["*", transactionID, "*"]
      }
    });    

    // Manually send the RELEASE back to Inbound Subscriptions
    for (i in this.bound){
      if (this.bound[i].endpoint.method.toLowerCase() == "answer" &&
          this.bound[i].endpoint.resource[1] == transactionID) {
        if (this.bound[i].callback == JSTP._answer) {
          JSTP._answer.call(this.bound[i].context, this, null, release);
        }

        // Actually release 'em
        this.dispatch(release, this.bound[i].callback, this.bound[i].context);
      }
    }

  },

The this.bound list gets modified inside the for loop and get out of bounds of the list.

xaviervia commented 11 years ago

Similar probably:

Unbinding ANSWER */6040c81a-7a1c-406e-999c-ee2d2c48b18d/*
Cannot read property 'endpoint' of undefined
TypeError: Cannot read property 'endpoint' of undefined
  at Object.JSTP._unbindTransactionID (/home/fetcher/Code/tiempy/node_modules/jstp/lib/jstp.js:470:24)
  at Object.JSTP.dispatch (/home/fetcher/Code/tiempy/node_modules/jstp/lib/jstp.js:215:14)
  at Object.JSTP._timeout (/home/fetcher/Code/tiempy/node_modules/jstp/lib/jstp.js:442:14)
  at [object Object]._onTimeout (/home/fetcher/Code/tiempy/node_modules/jstp/lib/jstp.js:173:16)
  at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
xaviervia commented 10 years ago

This version will stop being maintained soon. Since it the 2.0 version has grown from scratch, hopefully this will not happen.