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

Start mDNS only once per app #22

Merged
merged 4 commits into from
Dec 21, 2021
Merged

Start mDNS only once per app #22

merged 4 commits into from
Dec 21, 2021

Conversation

mickel8
Copy link
Member

@mickel8 mickel8 commented Dec 16, 2021

No description provided.

@mickel8 mickel8 requested a review from mat-hek December 16, 2021 15:23
@mickel8 mickel8 changed the title Start mDNS only once Start mDNS only once per app Dec 16, 2021
lib/mdns.ex Outdated

@spec query(pid(), String.t()) :: :ok
def query(from, address) do
GenServer.cast(__MODULE__, {:query, from, address})
Copy link
Member

Choose a reason for hiding this comment

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

we usually use send

Mdns.Client.query(address)
state = put_in(state, [:mdns_queries, address], {candidate, stream_id, component_id})
{:reply, :ok, state}
if Application.get_env(:ex_libnice, :mdns, true) do
Copy link
Member

Choose a reason for hiding this comment

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

a word of docs about this would be useful

@mickel8 mickel8 force-pushed the error-msg branch 2 times, most recently from 0759d21 to a2c302c Compare December 18, 2021 12:39
Comment on lines 8 to 11
```elixir
config :ex_libnice, mdns: false
```
"""
Copy link
Member

Choose a reason for hiding this comment

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

I think that readme would be a better place for this

lib/mdns.ex Outdated
[from]

pids ->
pids ++ [from]
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
pids ++ [from]
[from | pids]

lib/mdns.ex Outdated
end

@impl true
def handle_cast({:query, from, address}, state) do
Copy link
Member

Choose a reason for hiding this comment

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

If we're sending this, we should handle it in handle_info. Quite surprised it works this way

@mickel8 mickel8 force-pushed the error-msg branch 3 times, most recently from a5c12df to 4d4f25e Compare December 21, 2021 09:42
…ocs improvements. Add `ex_libnice` subdirectory.
@mickel8 mickel8 merged commit 0d7bc59 into master Dec 21, 2021
@mickel8 mickel8 deleted the error-msg branch December 21, 2021 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants