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

Add as_any to Conn trait for accessing underlying Conn #465

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

jaredwolff
Copy link
Contributor

This allows you to access the inner connection state of the DTLS connection. Having the connection identity is helpful in server code.

@codecov
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Attention: Patch coverage is 11.11111% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 61.65%. Comparing base (a97d49e) to head (ee9b09d).

Files Patch % Lines
ice/src/agent/agent_test.rs 0.00% 2 Missing ⚠️
ice/src/agent/agent_transport.rs 0.00% 2 Missing ⚠️
ice/src/agent/agent_vnet_test.rs 0.00% 2 Missing ⚠️
ice/src/udp_mux/udp_mux_conn.rs 0.00% 2 Missing ⚠️
.../association_internal/association_internal_test.rs 0.00% 2 Missing ⚠️
util/src/conn/conn_bridge.rs 0.00% 2 Missing ⚠️
util/src/conn/conn_disconnected_packet.rs 0.00% 2 Missing ⚠️
util/src/conn/conn_pipe.rs 0.00% 2 Missing ⚠️
util/src/conn/conn_udp.rs 0.00% 2 Missing ⚠️
util/src/conn/conn_udp_listener.rs 0.00% 2 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #465      +/-   ##
==========================================
- Coverage   61.71%   61.65%   -0.06%     
==========================================
  Files         529      529              
  Lines       48828    48852      +24     
  Branches    12250    12260      +10     
==========================================
- Hits        30134    30121      -13     
- Misses       9532     9572      +40     
+ Partials     9162     9159       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@rainliu rainliu left a comment

Choose a reason for hiding this comment

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

Could you consider to add as_any in Conn trait?

fn as_any(&self) -> &dyn std::any::Any;

so, you can use as_any().downcast_ref

if let Some(dtls) = dtls_conn.as_any().downcast_ref::<DTLSConn>() {
    dtls.connection_state().await.identity_hint
}

@jaredwolff
Copy link
Contributor Author

Missed this. Thanks @rainliu! I was having a bunch of trouble understanding/getting the downcast to work. Let me try it and then update this PR if it works out.

@jaredwolff jaredwolff marked this pull request as draft March 31, 2024 14:30
@jaredwolff jaredwolff force-pushed the jared/get-psk-identity branch from 8e95ad0 to 88ccbfc Compare March 31, 2024 15:39
@jaredwolff jaredwolff force-pushed the jared/get-psk-identity branch from 88ccbfc to ee9b09d Compare March 31, 2024 16:19
@jaredwolff jaredwolff changed the title Obtains connection state on accept for DTLS connections Add as_any to Conn trait for accessing underlying Conn Mar 31, 2024
@jaredwolff jaredwolff marked this pull request as ready for review March 31, 2024 16:31
@jaredwolff jaredwolff requested a review from rainliu March 31, 2024 16:31
@rainliu rainliu merged commit f452145 into webrtc-rs:master Apr 21, 2024
5 checks passed
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.

2 participants