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

Index does not exist in _nackHandler #22

Open
dbns97 opened this issue Mar 31, 2017 · 5 comments
Open

Index does not exist in _nackHandler #22

dbns97 opened this issue Mar 31, 2017 · 5 comments

Comments

@dbns97
Copy link

dbns97 commented Mar 31, 2017

In the function _nackHandler there is a timer variable using imp.wakeup() which is missing a bindenv(this). The variable _packages is not accessible because of this.

@ppetrosh
Copy link

Can you please try https://github.com/electricimp/messagemanager, which is the a major update to the Bullwinke library. It has a lot of issues resolved and is a significant improvement over it's predecessor. Please let us know if there is anything that prevents you from moving to the MessageManager. Thanks!

@dbns97
Copy link
Author

dbns97 commented Mar 31, 2017

Sure thing. Right now we just have Bullwinkle in existing projects but we will start moving to MessageManager.

@blindman2k
Copy link
Contributor

@ppetrosh, we will move over to MessageManager in due course but in the meantime, we should maintain Bullwinkle for the many users that are out there still. It's worth fixing it.

@ppetrosh
Copy link

@blindman2k I completely agree. We will take care of it.

@ppetrosh
Copy link

Tested this some more and gave it another look. The code we are talking here about is:

        local timer = imp.wakeup(0, function() {
            handler(BULLWINKLE_ERR_NO_HANDLER, message, retry);

            // Delete the message if the dev didn't retry
            if (message.type == BULLWINKLE_MESSAGE_TYPE.NACK) {
            	delete __bull._packages[message.id];
            }
        });

_packages is a property of an object __bull defined in the local scope:

local __bull = this;

So it should be accessible without any additional binding, which was an idea behind introducing this local variable. And so it works perfectly fine.

My test case is:

Agent:

@include "../Bullwinkle.lib.nut"
bull <- Bullwinkle();

Device:

@include "../Bullwinkle.lib.nut"
bull <- Bullwinkle();
bull.send("test", 1).onFail(function(error, message, retry) {});

What specific error do you see? Can you please provide your test case?

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

3 participants