GithubHelp home page GithubHelp logo

Comments (1)

jcbrand avatar jcbrand commented on July 28, 2024

I took a look at this ticket and at the code and the change looks sane.

The line in question is here.

this._requests.push(
        new Strophe.Request(body.tree()
                        this._onRequestStateChange.bind(
                                 this, this._conn._dataRecv.bind(this._conn)),
                        body.tree().getAttribute("rid")));
this._processRequest(this._requests.length - 1);

The last line should apparently be replaced with this._throttledRequestHandler()

this._requests.length can be either 1 or 2.

In the situation where the bug arises, there would be two requests. The first one which is hanging and then a new request to be made.

If you call this._throttleRequestHandler, then the first request will be processed first (via this._processRequest) and then the second, granted that it's not outside of the window (the max allowed spread between RID numbers).

See here

if (this._requests.length > 0) {
    this._processRequest(0);
}

if (this._requests.length > 1 &&  Math.abs(this._requests[0].rid -  this._requests[1].rid) < this.window) {
    this._processRequest(1);
}

This is different to how things were done up to now, i.e. the 2nd request was processed and the 1st one ignored. Hence the bug.

I've tested this fix with converse.js and everything looks in order.

I'll push out the fix now. If anyone knows of any reason why this fix is not a good idea, please let me know.

from strophejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.