aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP
diff options
context:
space:
mode:
authorMelanie2013-10-04 20:03:12 +0100
committerMelanie2013-10-04 20:03:12 +0100
commit75c68fa29e3a2fed81c883e7925bf161e968639f (patch)
tree13ba69e6818f634018a5954d38750cf48128b7f8 /OpenSim/Region/ClientStack/Linden/UDP
parentMerge branch 'avination-current' into careminster (diff)
parentminor: Disable logging left active on regression test TestSameSimulatorIsolat... (diff)
downloadopensim-SC_OLD-75c68fa29e3a2fed81c883e7925bf161e968639f.zip
opensim-SC_OLD-75c68fa29e3a2fed81c883e7925bf161e968639f.tar.gz
opensim-SC_OLD-75c68fa29e3a2fed81c883e7925bf161e968639f.tar.bz2
opensim-SC_OLD-75c68fa29e3a2fed81c883e7925bf161e968639f.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Data/MySQL/MySQLSimulationData.cs OpenSim/Data/MySQL/Resources/RegionStore.migrations OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs3
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs74
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs39
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs9
4 files changed, 98 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 36edd0b..51cc2bf 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -783,7 +783,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
783 783
784 public virtual void Start() 784 public virtual void Start()
785 { 785 {
786 m_scene.AddNewClient(this, PresenceType.User); 786 m_scene.AddNewAgent(this, PresenceType.User);
787 787
788 RefreshGroupMembership(); 788 RefreshGroupMembership();
789 } 789 }
@@ -12548,6 +12548,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12548 12548
12549 shape.PCode = addPacket.ObjectData.PCode; 12549 shape.PCode = addPacket.ObjectData.PCode;
12550 shape.State = addPacket.ObjectData.State; 12550 shape.State = addPacket.ObjectData.State;
12551 shape.LastAttachPoint = addPacket.ObjectData.State;
12551 shape.PathBegin = addPacket.ObjectData.PathBegin; 12552 shape.PathBegin = addPacket.ObjectData.PathBegin;
12552 shape.PathEnd = addPacket.ObjectData.PathEnd; 12553 shape.PathEnd = addPacket.ObjectData.PathEnd;
12553 shape.PathScaleX = addPacket.ObjectData.PathScaleX; 12554 shape.PathScaleX = addPacket.ObjectData.PathScaleX;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index ad3f715..01981dd 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1764,32 +1764,76 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1764 endPoint = (IPEndPoint)array[0]; 1764 endPoint = (IPEndPoint)array[0];
1765 CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1]; 1765 CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1];
1766 1766
1767 m_log.DebugFormat(
1768 "[LLUDPSERVER]: Handling CompleteAgentMovement request from {0} in {1}", endPoint, m_scene.Name);
1769
1767 // Determine which agent this packet came from 1770 // Determine which agent this packet came from
1768 int count = 20; 1771 // We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination
1769 bool ready = false; 1772 // simulator with no existing child presence, the viewer (at least LL 3.3.4) will send UseCircuitCode
1770 while (!ready && count-- > 0) 1773 // and then CompleteAgentMovement immediately without waiting for an ack. As we are now handling these
1774 // packets asynchronously, we need to account for this thread proceeding more quickly than the
1775 // UseCircuitCode thread.
1776 int count = 40;
1777 while (count-- > 0)
1771 { 1778 {
1772 if (m_scene.TryGetClient(endPoint, out client) && client.IsActive && client.SceneAgent != null) 1779 if (m_scene.TryGetClient(endPoint, out client))
1773 { 1780 {
1774 LLClientView llClientView = (LLClientView)client; 1781 if (!client.IsActive)
1775 LLUDPClient udpClient = llClientView.UDPClient; 1782 {
1776 if (udpClient != null && udpClient.IsConnected) 1783 // This check exists to catch a condition where the client has been closed by another thread
1777 ready = true; 1784 // but has not yet been removed from the client manager (and possibly a new connection has
1785 // not yet been established).
1786 m_log.DebugFormat(
1787 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active yet. Waiting.",
1788 endPoint, client.Name, m_scene.Name);
1789 }
1790 else if (client.SceneAgent == null)
1791 {
1792 // This check exists to catch a condition where the new client has been added to the client
1793 // manager but the SceneAgent has not yet been set in Scene.AddNewAgent(). If we are too
1794 // eager, then the new ScenePresence may not have registered a listener for this messsage
1795 // before we try to process it.
1796 // XXX: A better long term fix may be to add the SceneAgent before the client is added to
1797 // the client manager
1798 m_log.DebugFormat(
1799 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client SceneAgent not set yet. Waiting.",
1800 endPoint, client.Name, m_scene.Name);
1801 }
1778 else 1802 else
1779 { 1803 {
1780 m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)"); 1804 break;
1781 Thread.Sleep(200);
1782 } 1805 }
1783 } 1806 }
1784 else 1807 else
1785 { 1808 {
1786 m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)"); 1809 m_log.DebugFormat(
1787 Thread.Sleep(200); 1810 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} in {1} but no client exists yet. Waiting.",
1811 endPoint, m_scene.Name);
1788 } 1812 }
1813
1814 Thread.Sleep(200);
1789 } 1815 }
1790 1816
1791 if (client == null) 1817 if (client == null)
1818 {
1819 m_log.DebugFormat(
1820 "[LLUDPSERVER]: No client found for CompleteAgentMovement from {0} in {1} after wait. Dropping.",
1821 endPoint, m_scene.Name);
1822
1823 return;
1824 }
1825 else if (!client.IsActive || client.SceneAgent == null)
1826 {
1827 // This check exists to catch a condition where the client has been closed by another thread
1828 // but has not yet been removed from the client manager.
1829 // The packet could be simply ignored but it is useful to know if this condition occurred for other debugging
1830 // purposes.
1831 m_log.DebugFormat(
1832 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active after wait. Dropping.",
1833 endPoint, client.Name, m_scene.Name);
1834
1792 return; 1835 return;
1836 }
1793 1837
1794 IncomingPacket incomingPacket1; 1838 IncomingPacket incomingPacket1;
1795 1839
@@ -1810,7 +1854,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1810 catch (Exception e) 1854 catch (Exception e)
1811 { 1855 {
1812 m_log.ErrorFormat( 1856 m_log.ErrorFormat(
1813 "[LLUDPSERVER]: CompleteMovementIntoRegion handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", 1857 "[LLUDPSERVER]: CompleteAgentMovement handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}",
1814 endPoint != null ? endPoint.ToString() : "n/a", 1858 endPoint != null ? endPoint.ToString() : "n/a",
1815 client != null ? client.Name : "unknown", 1859 client != null ? client.Name : "unknown",
1816 client != null ? client.AgentId.ToString() : "unknown", 1860 client != null ? client.AgentId.ToString() : "unknown",
@@ -1921,7 +1965,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1921 client.Kick("Simulator logged you out due to connection timeout."); 1965 client.Kick("Simulator logged you out due to connection timeout.");
1922 } 1966 }
1923 1967
1924 m_scene.IncomingCloseAgent(client.AgentId, true); 1968 m_scene.CloseAgent(client.AgentId, true);
1925 } 1969 }
1926 1970
1927 private void IncomingPacketHandler() 1971 private void IncomingPacketHandler()
@@ -2264,7 +2308,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2264 if (!client.IsLoggingOut) 2308 if (!client.IsLoggingOut)
2265 { 2309 {
2266 client.IsLoggingOut = true; 2310 client.IsLoggingOut = true;
2267 m_scene.IncomingCloseAgent(client.AgentId, false); 2311 m_scene.CloseAgent(client.AgentId, false);
2268 } 2312 }
2269 } 2313 }
2270 } 2314 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 48c5b37..881e768 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -291,7 +291,16 @@ namespace OpenMetaverse
291 m_log.Warn("[UDPBASE]: Salvaged the UDP listener on port " + m_udpPort); 291 m_log.Warn("[UDPBASE]: Salvaged the UDP listener on port " + m_udpPort);
292 } 292 }
293 } 293 }
294 catch (ObjectDisposedException) { } 294 catch (ObjectDisposedException e)
295 {
296 m_log.Error(
297 string.Format("[UDPBASE]: Error processing UDP begin receive {0}. Exception ", UdpReceives), e);
298 }
299 catch (Exception e)
300 {
301 m_log.Error(
302 string.Format("[UDPBASE]: Error processing UDP begin receive {0}. Exception ", UdpReceives), e);
303 }
295 } 304 }
296 } 305 }
297 306
@@ -308,12 +317,12 @@ namespace OpenMetaverse
308 if (m_asyncPacketHandling) 317 if (m_asyncPacketHandling)
309 AsyncBeginReceive(); 318 AsyncBeginReceive();
310 319
311 // get the buffer that was created in AsyncBeginReceive
312 // this is the received data
313 UDPPacketBuffer buffer = (UDPPacketBuffer)iar.AsyncState;
314
315 try 320 try
316 { 321 {
322 // get the buffer that was created in AsyncBeginReceive
323 // this is the received data
324 UDPPacketBuffer buffer = (UDPPacketBuffer)iar.AsyncState;
325
317 int startTick = Util.EnvironmentTickCount(); 326 int startTick = Util.EnvironmentTickCount();
318 327
319 // get the length of data actually read from the socket, store it with the 328 // get the length of data actually read from the socket, store it with the
@@ -341,8 +350,24 @@ namespace OpenMetaverse
341 m_currentReceiveTimeSamples++; 350 m_currentReceiveTimeSamples++;
342 } 351 }
343 } 352 }
344 catch (SocketException) { } 353 catch (SocketException se)
345 catch (ObjectDisposedException) { } 354 {
355 m_log.Error(
356 string.Format(
357 "[UDPBASE]: Error processing UDP end receive {0}, socket error code {1}. Exception ",
358 UdpReceives, se.ErrorCode),
359 se);
360 }
361 catch (ObjectDisposedException e)
362 {
363 m_log.Error(
364 string.Format("[UDPBASE]: Error processing UDP end receive {0}. Exception ", UdpReceives), e);
365 }
366 catch (Exception e)
367 {
368 m_log.Error(
369 string.Format("[UDPBASE]: Error processing UDP end receive {0}. Exception ", UdpReceives), e);
370 }
346 finally 371 finally
347 { 372 {
348// if (UsePools) 373// if (UsePools)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
index 119a677..e2178e5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
@@ -52,17 +52,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
52 public override void Update(int frames) {} 52 public override void Update(int frames) {}
53 public override void LoadWorldMap() {} 53 public override void LoadWorldMap() {}
54 54
55 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) 55 public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type)
56 { 56 {
57 client.OnObjectName += RecordObjectNameCall; 57 client.OnObjectName += RecordObjectNameCall;
58 58
59 // FIXME 59 // FIXME
60 return null; 60 return null;
61 } 61 }
62 62
63 public override void RemoveClient(UUID agentID, bool someReason) {} 63 public override bool CloseAgent(UUID agentID, bool force) { return true; }
64// public override void CloseAllAgents(uint circuitcode) {} 64
65 public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; } 65 public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; }
66
66 public override void OtherRegionUp(GridRegion otherRegion) { } 67 public override void OtherRegionUp(GridRegion otherRegion) { }
67 68
68 public override bool TryGetScenePresence(UUID uuid, out ScenePresence sp) { sp = null; return false; } 69 public override bool TryGetScenePresence(UUID uuid, out ScenePresence sp) { sp = null; return false; }