Skip to content

Commit

Permalink
Support Erlang 19 inet_drv changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lexmag committed Sep 10, 2016
1 parent 00038f3 commit 991eac3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/statix/packet.ex
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
defmodule Statix.Packet do
use Bitwise

otp_release = :erlang.system_info(:otp_release)
@addr_family if(otp_release >= '19', do: [1], else: [])

def header({n1, n2, n3, n4}, port) do
[band(bsr(port, 8), 0xFF),
band(port, 0xFF),
band(n1, 0xFF),
band(n2, 0xFF),
band(n3, 0xFF),
band(n4, 0xFF)]
@addr_family ++ [
band(bsr(port, 8), 0xFF),
band(port, 0xFF),
band(n1, 0xFF),
band(n2, 0xFF),
band(n3, 0xFF),
band(n4, 0xFF)
]
end

def build(header, name, key, val) do
Expand Down

0 comments on commit 991eac3

Please sign in to comment.