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.
mb-throttle-test
Justin Clark-Casey (justincc) 2014-10-30 20:54:23 +00:00
parent b53be022f2
commit 5d5ea9234f
1 changed files with 6 additions and 0 deletions

View File

@ -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;