Better setup for non-windows multicast sockets.
In addition to SO_REUSEADDR, that we were setting before, via AllowAddressReuse(), for sockets for use with multicast, now also set SO_REUSEPORT whenever that option is defined. On some non-Windows platforms, this is needed for multicast messages to be received by all sockets listening for them. This option is only set in a new AllowAddressSharingForMulticast() method as the SO_REUSEADDR and AllowAddressReuse() have other non-multicast uses where SO_REUSEPORT would not be appropriate. Also, for non-Windows platforms, bind the multicast sockets to the multicast group address rather than to a wildcard. This will make us more likely to only get messages from the relevant multicast group as some platforms will otherwise give the socket any multicast messages from groups joined by any sockets in the system. No change on Windows where binding to a multicast group is not allowed. TBR=thestig@chromium.org Change-Id: I24d9d4a0d85134074b2deb14914a41109d7f724a Bug: 899310 Reviewed-on: https://chromium-review.googlesource.com/c/1298298 Commit-Queue: Eric Orth <ericorth@chromium.org> Reviewed-by:Lei Zhang <thestig@chromium.org> Reviewed-by:
Matt Menke <mmenke@chromium.org> Reviewed-by:
Tom Sepez <tsepez@chromium.org> Cr-Commit-Position: refs/heads/master@{#603180}
Showing
Please register or sign in to comment