=doc #15772 Make IPv6 multicast tests work on OS X

* Fixed a small race by waiting for the listenert to be bound
* Changed the Java test to test the Java code (imported the wrong class)
* Changed to a known link local multicas address (the old one just gave me a nop route to host)
This commit is contained in:
Björn Antonsson 2014-09-05 10:17:57 +02:00
parent dd71de5f93
commit cd90acef96
4 changed files with 42 additions and 17 deletions

View file

@ -37,22 +37,24 @@ class Listener(iface: String, group: String, port: Int, sink: ActorRef) extends
//#bind
def receive = {
case Udp.Bound(to) => log.info(s"Bound to $to")
case b @ Udp.Bound(to) =>
log.info("Bound to {}", to)
sink ! (b)
case Udp.Received(data, remote) =>
val msg = data.decodeString("utf-8")
log.info(s"Received '$msg' from '$remote'")
log.info("Received '{}' from {}", msg, remote)
sink ! msg
}
}
class Sender(group: String, port: Int, msg: String) extends Actor with ActorLogging {
class Sender(iface: String, group: String, port: Int, msg: String) extends Actor with ActorLogging {
import context.system
IO(Udp) ! Udp.SimpleSender(List(Inet6ProtocolFamily()))
def receive = {
case Udp.SimpleSenderReady => {
val remote = new InetSocketAddress(group, port)
log.info(s"Sending message to $remote")
val remote = new InetSocketAddress(s"$group%$iface", port)
log.info("Sending message to {}", remote)
sender() ! Udp.Send(ByteString(msg), remote)
}
}