Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank request can get sent after disconnection (depending on timing) #72

Open
hulusjang opened this issue Dec 30, 2011 · 0 comments
Open

Comments

@hulusjang
Copy link

In the following code (core.js, inside _onIdle, line 3589):

    if (this._requests.length < 2 && this._data.length > 0 &&
        !this.paused) {
        ...
        this._requests.push(   // <--------------- line 3589
            new Strophe.Request(body.tree(),
                                this._onRequestStateChange.bind(
                                    this, this._dataRecv.bind(this)),
                                body.tree().getAttribute("rid")));
        this._processRequest(this._requests.length - 1);
    }

Depending on timing, this code seems to queue a poll request even after "terminate" message has been processed. This results in 404 being returned from server, and causes uncaught exception: TypeError: elem.getAttribute is not a function.

Perhaps, we should check for this.disconnecting variable before queuing a new request?

Here is a quick fix for this problem. However, a better fix should be possible:

        if (!this.disconnecting) {
            this._requests.push(
                new Strophe.Request(body.tree(),
                                    this._onRequestStateChange.bind(
                                        this, this._dataRecv.bind(this)),
                                    body.tree().getAttribute("rid")));
        }
        if (this._requests.length > 0) {
            this._processRequest(this._requests.length - 1);
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant