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

Cannot override exist protocol implementation #3

Open
gyson opened this issue Sep 17, 2019 · 0 comments
Open

Cannot override exist protocol implementation #3

gyson opened this issue Sep 17, 2019 · 0 comments

Comments

@gyson
Copy link

gyson commented Sep 17, 2019

When I follow README instructions and try to override PayloadType for Protocol.Udp like following:

defimpl PayloadType, for: Protocol.Udp do
  def payload_parser(_data) do
    nil # override default Protocol.Dns
  end
end

Above code will override exist protocol implementation, which results two issues:

  1. warning about redefining module:
warning: redefining module PayloadType.Protocol.Udp (current version loaded from /app/_build/prod/lib/expcap/ebin/Elixir.PayloadType.Protocol.Udp.beam)
  lib/my_app/path/to/file.ex:123
  1. compile with mix release (1.9) would result error:
** (Mix) Duplicated modules:
        'Elixir.PayloadType.Protocol.Udp' specified in my_app and expcap

I googled a little bit, it does not seem to have a general way to override an exist protocol implementation, e.g. this thread.

Thanks for the nice library! Any suggestion on this ?

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

No branches or pull requests

1 participant