Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #11 from nmeum/configure-maddrs
Browse files Browse the repository at this point in the history
Allow configuration of multicast groups
  • Loading branch information
nning committed Mar 31, 2018
2 parents 1322b1f + fcd7aa9 commit 474e5b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/david/app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AppConfig < Hash
:Log => nil,
:MinimalMapping => false,
:Multicast => true,
:MulticastAddrs => ['ff02::fd', 'ff05::fd'],
:Observe => true,
:Port => ::CoAP::PORT
}
Expand Down Expand Up @@ -67,7 +68,11 @@ def choose_minimalmapping(value)
def choose_multicast(value)
default_to_true(:multicast, value)
end


def choose_multicastaddrs(value)
value
end

def choose_observe(value)
default_to_true(:observe, value)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/david/server/multicast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def multicast_initialize!
@socket.to_io.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1)

if ipv6?
maddrs = ['ff02::fd', 'ff05::fd']
maddrs = @options[:MulticastAddrs]
maddrs << 'ff02::1' if OS.osx? # OSX needs ff02::1 explicitly joined.
maddrs.each { |maddr| multicast_listen_ipv6(maddr) }

Expand Down

0 comments on commit 474e5b8

Please sign in to comment.