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

Event Manager handle_in_client hooks #1916

Merged
merged 7 commits into from
Mar 12, 2024
Merged

Event Manager handle_in_client hooks #1916

merged 7 commits into from
Mar 12, 2024

Conversation

tokatoka
Copy link
Member

@tokatoka tokatoka commented Mar 7, 2024

No description provided.

}
}

impl<Head, Tail, S> EventManagerHooksTuple<S> for (Head, Tail)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old question: why don't we just do a vec with the hooks in it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot constrain per-type/cannot look for specific trait impls/etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just give it all we got

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding and removing hooks on the fly will be useful

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just don't understand why one wouldn't implement a hook with dynamic behaviour instead. You aren't going to be generating hooks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the generic is concretised in the call, not in the type. You'd need it to be concretised in the type for it to be a concrete dyn.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not the situation... The function being called must be generic. There's no concrete type A or B beforehand.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I get what you mean... The obvious solution would be not to give the hooks access to executor or fuzzer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, access to state and event manager should be fine tbh

@@ -593,9 +629,6 @@ where
} => {
log::info!("Received new Testcase from {client_id:?} ({client_config:?}, forward {forward_id:?})");

if let Ok(meta) = state.metadata_mut::<TransferringMetadata>() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you ok with this?
@addisoncrump

there're two way to achieve what you want now.
1st way is to just make a hook that set this metadata (which i don't recommend)
2nd way is to make a hook that does what you want when new testcase comes, and return false then the subsequent testcase processing is skipped

@tokatoka tokatoka merged commit 5f67b9f into main Mar 12, 2024
26 checks passed
@tokatoka tokatoka deleted the EM_handler branch March 12, 2024 13:39
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

Successfully merging this pull request may close these issues.

3 participants