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

Use new, struct-based ex_dtls; add tests #17

Merged
merged 4 commits into from
Nov 21, 2023
Merged

Use new, struct-based ex_dtls; add tests #17

merged 4 commits into from
Nov 21, 2023

Conversation

LVala
Copy link
Member

@LVala LVala commented Nov 20, 2023

No description provided.

@LVala LVala self-assigned this Nov 20, 2023
@LVala LVala requested a review from mickel8 November 20, 2023 08:14

{:ok, ice_agent} = ICEAgent.start_link(:controlled, ice_config)
{:ok, ice_agent} = ice_module.start_link(:controlled, ice_config)
Copy link
Member

@mickel8 mickel8 Nov 20, 2023

Choose a reason for hiding this comment

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

To be perfect we should define a behavior for ice_module but I don't insist

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe let's let it be for now, especially considering that DTLSTransport uses exactly one function from ICEAgent API.

lib/ex_webrtc/dtls_transport.ex Show resolved Hide resolved
end

test "forwards non-data ICE messages", %{dtls: dtls} do
message = "test message"
Copy link
Member

Choose a reason for hiding this comment

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

better send some signaling message like connection state change albo gathering state change

send_ice(dtls, :connected)

assert_receive {:fake_ice, _packets}
assert_receive {:fake_ice, _retransmited}, 1200
Copy link
Member

Choose a reason for hiding this comment

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

assert packets and retransmitted are the same

Copy link
Member Author

Choose a reason for hiding this comment

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

But they are not the same tho.

assert is_binary(packets)
end

test "finishes handshake in actice mode", %{dtls: dtls} do
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
test "finishes handshake in actice mode", %{dtls: dtls} do
test "finishes handshake in active mode", %{dtls: dtls} do

end
end

defp send_ice(dtls, msg), do: send(dtls, {:ex_ice, "dummy_pid", msg})
Copy link
Member

Choose a reason for hiding this comment

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

I would make this accept ice_pid instead i.e

Suggested change
defp send_ice(dtls, msg), do: send(dtls, {:ex_ice, "dummy_pid", msg})
defp send_ice(ice_agent, msg), do: send(ice_agent, {:send, msg})

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Merging #17 (eafd2c3) into master (d258b94) will increase coverage by 8.31%.
The diff coverage is 82.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #17      +/-   ##
==========================================
+ Coverage   74.47%   82.79%   +8.31%     
==========================================
  Files          10       10              
  Lines         427      430       +3     
==========================================
+ Hits          318      356      +38     
+ Misses        109       74      -35     
Files Coverage Δ
lib/ex_webrtc/dtls_transport.ex 84.72% <82.60%> (+51.38%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d258b94...eafd2c3. Read the comment docs.

@LVala LVala merged commit daa448a into master Nov 21, 2023
4 checks passed
@LVala LVala deleted the dtls-improvements branch November 21, 2023 09:52
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