From 5d5ea9234ffc71876bc55789ab764c294a913b95 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 30 Oct 2014 20:54:23 +0000 Subject: Stop Mono 3.2.8 from binding a UDP socket to a port already in use. At least on Mono 3.2.8 (but not under Windows), one can bind multiple UDP sockets to the same port by default. Different simulators cannot demultiplex each other's messages, so a set of confusing non-obvious errors arise if this occurs. This change prevents such multiple binding. --- OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 5323d5a..94300f8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -168,6 +168,12 @@ namespace OpenMetaverse m_log.Debug("[UDPBASE]: SIO_UDP_CONNRESET flag not supported on this platform, ignoring"); } + // On at least Mono 3.2.8, multiple UDP sockets can bind to the same port by default. At the moment + // we never want two regions to listen on the same port as they cannot demultiplex each other's messages, + // leading to a confusing bug. + // By default, Windows does not allow two sockets to bind to the same port. + m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); + if (recvBufferSize != 0) m_udpSocket.ReceiveBufferSize = recvBufferSize; -- cgit v1.1