-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fix the EventListener::new() footgun #94
Conversation
This causes a worrying performance regression.
|
|
The bottleneck comes from the additional |
I find this regression much more palatable. |
This is a breaking change. It makes `new()` take no parameters in its signature and `listen()` take a reference to an event in its signature. This should avoid a footgun where a listener can be waited on without listening on it. Closes #91 Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
436a159
to
1911542
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this work and making sure there is no significant performance hit. 👍
smol-rs/event-listener#94 Signed-off-by: John Nunley <dev@notgull.net>
This commit makes it so EventListener::listen() does not overwrite existing listeners if they already exist. If the listener is already registered in an event listener list, it removes the listener from that list before registering the new listener. This soundness bug was missed during #94. This is a patch-compatible fix for #100. We may also want an API-level fix for #100 as well. This is up for further discussion. Signed-off-by: John Nunley <dev@notgull.net>
This commit makes it so EventListener::listen() does not overwrite existing listeners if they already exist. If the listener is already registered in an event listener list, it removes the listener from that list before registering the new listener. This soundness bug was missed during #94. This is a patch-compatible fix for #100. We may also want an API-level fix for #100 as well. This is up for further discussion. Signed-off-by: John Nunley <dev@notgull.net>
This commit makes it so EventListener::listen() does not overwrite existing listeners if they already exist. If the listener is already registered in an event listener list, it removes the listener from that list before registering the new listener. This soundness bug was missed during #94. This is a patch-compatible fix for #100. We may also want an API-level fix for #100 as well. This is up for further discussion. Signed-off-by: John Nunley <dev@notgull.net>
This commit makes it so EventListener::listen() does not overwrite existing listeners if they already exist. If the listener is already registered in an event listener list, it removes the listener from that list before registering the new listener. This soundness bug was missed during #94. This is a patch-compatible fix for #100. We may also want an API-level fix for #100 as well. This is up for further discussion. Signed-off-by: John Nunley <dev@notgull.net>
This commit makes it so EventListener::listen() does not overwrite existing listeners if they already exist. If the listener is already registered in an event listener list, it removes the listener from that list before registering the new listener. This soundness bug was missed during #94. This is a patch-compatible fix for #100. We may also want an API-level fix for #100 as well. This is up for further discussion. Signed-off-by: John Nunley <dev@notgull.net>
This is a breaking change. It makes
new()
take no parameters in itssignature and
listen()
take a reference to an event in its signature.This should avoid a footgun where a listener can be waited on without
listening on it.
Closes #91
cc @zeenix