aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-12-14 13:35:53 +0000
committerUbitUmarov2016-12-14 13:35:53 +0000
commit18a292ad02e590619760a71aeb1514e6916b257f (patch)
tree584faa43265cc20ee36d92b2bc14cb1c55435ef0 /OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
parentMerge branch 'master' into httptests (diff)
parentfix: check for region_handle before region_id, viewers are so funny.. (diff)
downloadopensim-SC-18a292ad02e590619760a71aeb1514e6916b257f.zip
opensim-SC-18a292ad02e590619760a71aeb1514e6916b257f.tar.gz
opensim-SC-18a292ad02e590619760a71aeb1514e6916b257f.tar.bz2
opensim-SC-18a292ad02e590619760a71aeb1514e6916b257f.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs20
1 files changed, 15 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 4d726b4..831381e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -107,6 +107,11 @@ namespace OpenMetaverse
107 /// </summary> 107 /// </summary>
108 public float AverageReceiveTicksForLastSamplePeriod { get; private set; } 108 public float AverageReceiveTicksForLastSamplePeriod { get; private set; }
109 109
110 public int Port
111 {
112 get { return m_udpPort; }
113 }
114
110 #region PacketDropDebugging 115 #region PacketDropDebugging
111 /// <summary> 116 /// <summary>
112 /// For debugging purposes only... random number generator for dropping 117 /// For debugging purposes only... random number generator for dropping
@@ -217,10 +222,6 @@ namespace OpenMetaverse
217 SocketType.Dgram, 222 SocketType.Dgram,
218 ProtocolType.Udp); 223 ProtocolType.Udp);
219 224
220 // OpenSim may need this but in AVN, this messes up automated
221 // sim restarts badly
222 //m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);
223
224 try 225 try
225 { 226 {
226 if (m_udpSocket.Ttl < 128) 227 if (m_udpSocket.Ttl < 128)
@@ -248,13 +249,22 @@ namespace OpenMetaverse
248 // we never want two regions to listen on the same port as they cannot demultiplex each other's messages, 249 // we never want two regions to listen on the same port as they cannot demultiplex each other's messages,
249 // leading to a confusing bug. 250 // leading to a confusing bug.
250 // By default, Windows does not allow two sockets to bind to the same port. 251 // By default, Windows does not allow two sockets to bind to the same port.
251 m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); 252 //
253 // Unfortunately, this also causes a crashed sim to leave the socket in a state
254 // where it appears to be in use but is really just hung from the old process
255 // crashing rather than closing it. While this protects agains misconfiguration,
256 // allowing crashed sims to be started up again right away, rather than having to
257 // wait 2 minutes for the socket to clear is more valuable. Commented 12/13/2016
258 // m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);
252 259
253 if (recvBufferSize != 0) 260 if (recvBufferSize != 0)
254 m_udpSocket.ReceiveBufferSize = recvBufferSize; 261 m_udpSocket.ReceiveBufferSize = recvBufferSize;
255 262
256 m_udpSocket.Bind(ipep); 263 m_udpSocket.Bind(ipep);
257 264
265 if (m_udpPort == 0)
266 m_udpPort = ((IPEndPoint)m_udpSocket.LocalEndPoint).Port;
267
258 IsRunningInbound = true; 268 IsRunningInbound = true;
259 269
260 // kick off an async receive. The Start() method will return, the 270 // kick off an async receive. The Start() method will return, the