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

ONVIF Discovery Handler - Handle Multicast Response Duplicates #382

Merged

Conversation

kate-goldenring
Copy link
Contributor

What this PR does / why we need it:
closes #365

Special notes for your reviewer:
Seems like our multicast occasionally returns the same service url twice. Simply deduping the returned ONVIF service URLs seems like a good strategy.

If applicable:

  • this PR has an associated PR with documentation in akri-docs
  • this PR contains unit tests
  • added code adheres to standard Rust formatting (cargo fmt)
  • code builds properly (cargo build)
  • code is free of common mistakes (cargo clippy)
  • all Akri tests succeed (cargo test)
  • inline documentation builds (cargo doc)
  • version has been updated appropriately (./version.sh)

@kate-goldenring kate-goldenring changed the title remove multicast response duplicates ONVIF Discovery Handler - Handle Multicast Response Duplicates Sep 21, 2021
@kate-goldenring kate-goldenring added the bug Something isn't working label Sep 21, 2021
@@ -352,6 +352,7 @@ pub mod util {
"simple_onvif_discover - uris after filtering by scopes {:?}",
filtered_uris
);
filtered_uris.dedup();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to have broadcast_responses to be a set so that we do not capture duplicates in the first place or dedup on broadcast_responses prior to calling get_scope_filtered_uris_from_discovery_response?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Switched to a hashset in 80bcc3b

@romoh
Copy link
Contributor

romoh commented Sep 22, 2021

Curious, do we understand why duplicates happen in the first place?
I wonder if this is a side effect for another bug and we are only solving the symptom here.

@kate-goldenring
Copy link
Contributor Author

Curious, do we understand why duplicates happen in the first place?
I wonder if this is a side effect for another bug and we are only solving the symptom here.

Might be. Have no way of telling until we run into it or get the logs.

@romoh
Copy link
Contributor

romoh commented Sep 27, 2021

Curious, do we understand why duplicates happen in the first place?
I wonder if this is a side effect for another bug and we are only solving the symptom here.

Might be. Have no way of telling until we run into it or get the logs.

Fair. Maybe it is worth adding a note in the bug and making sure we have enough logging in place to be able to root cause this if it happens again.

@@ -323,7 +323,7 @@ pub mod util {

match try_recv_string(socket, time_left).await {
Ok(s) => {
broadcast_responses.push(s);
broadcast_responses.insert(s);
Copy link
Collaborator

Choose a reason for hiding this comment

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

i wonder if we might want to s.ToLower here (i assume that a device would be consistent in how it describes itself, so it seems like this wouldn't be needed ... but something to think about)

@kate-goldenring kate-goldenring merged commit 10a0d78 into project-akri:main Sep 28, 2021
@kate-goldenring kate-goldenring deleted the onvif-duplicates-bug branch September 28, 2021 20:40
vincepnguyen pushed a commit that referenced this pull request Nov 23, 2021
Signed-off-by: vincepnguyen <70007233+vincepnguyen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove duplicates after discovering ONVIF cameras.
4 participants