Closed heikki closed 9 years ago
Created separate issue from once/removeListener problem https://github.com/tessel/runtime/issues/599
It's been a while since I looked at this code. I'm trying to make sense of it again,
Did the line you remove (self.removeListener('post', reply);
) do anything? It doesn't look like it did.
What was happening with the memleak? I'm guessing that post
events kept attaching without it ever being removed.
That removed line didn't do anything.
Every timeout left one post
event listener there. They were cleared on successfull post though. Bigger problem with timeout was that RXQueue wasn't cleared. Sometimes it led to overflow and sometimes it caused next command to fail even though the received data was valid.
Approved by @jiahuang. Running tests.
Thanks for tracking that bug down :)
Removes post event listener and resets postmaster on timeout.
Btw.once
and.removeListener
don't work together. I'm not sure if they're supposed to.