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

node-inotify needs to use another way to save the callbacks other than the watch file descriptor as key #9

Open
c4milo opened this issue Oct 27, 2010 · 2 comments

Comments

@c4milo
Copy link
Owner

c4milo commented Oct 27, 2010

node-inotify needs to use another way to save the callbacks other than the watch file descriptor as key. When you make a removeWatch and a subsequent addWatch, inotify is using the same watch descriptor which is problematic because when the last event of the removed watch arrive, the callback deleted belongs to the new addWatch which is completely wrong !

@networkimprov
Copy link

This is a segfault issue, with a simple fix. (I worked around it by making sure to add before removing.)

The easy fix: in AddWatch(), before calling
inotify->handle_->Set(descriptor, args_->Get(callback_sym));
throw an error if the descriptor already has a value.

@c4milo
Copy link
Owner Author

c4milo commented Dec 20, 2010

Ok, I will do this as a work around. The best solution is using a hash (sha1?) as object key instead of the watch file descriptor. We can use maybe the crypto module that comes with NodeJS and use as key the Watch File Descriptor for the module to generate the hash.

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

2 participants