aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs83
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs24
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs18
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs18
6 files changed, 98 insertions, 76 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 7eb829e..49b9378 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -785,6 +785,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
785 public virtual void SendLayerData(float[] map) 785 public virtual void SendLayerData(float[] map)
786 { 786 {
787 Util.FireAndForget(DoSendLayerData, map); 787 Util.FireAndForget(DoSendLayerData, map);
788
789 // Send it sync, and async. It's not that much data
790 // and it improves user experience just so much!
791 DoSendLayerData(map);
788 } 792 }
789 793
790 /// <summary> 794 /// <summary>
@@ -797,16 +801,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
797 801
798 try 802 try
799 { 803 {
800 //for (int y = 0; y < 16; y++) 804 for (int y = 0; y < 16; y++)
801 //{ 805 {
802 // for (int x = 0; x < 16; x++) 806 for (int x = 0; x < 16; x+=4)
803 // { 807 {
804 // SendLayerData(x, y, map); 808 SendLayerPacket(x, y, map);
805 // } 809 }
806 //} 810 }
807
808 // Send LayerData in a spiral pattern. Fun!
809 SendLayerTopRight(map, 0, 0, 15, 15);
810 } 811 }
811 catch (Exception e) 812 catch (Exception e)
812 { 813 {
@@ -814,51 +815,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
814 } 815 }
815 } 816 }
816 817
817 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
818 {
819 // Row
820 for (int i = x1; i <= x2; i++)
821 SendLayerData(i, y1, map);
822
823 // Column
824 for (int j = y1 + 1; j <= y2; j++)
825 SendLayerData(x2, j, map);
826
827 if (x2 - x1 > 0)
828 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
829 }
830
831 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
832 {
833 // Row in reverse
834 for (int i = x2; i >= x1; i--)
835 SendLayerData(i, y2, map);
836
837 // Column in reverse
838 for (int j = y2 - 1; j >= y1; j--)
839 SendLayerData(x1, j, map);
840
841 if (x2 - x1 > 0)
842 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
843 }
844
845 /// <summary> 818 /// <summary>
846 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 819 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
847 /// </summary> 820 /// </summary>
848 /// <param name="map">heightmap</param> 821 /// <param name="map">heightmap</param>
849 /// <param name="px">X coordinate for patches 0..12</param> 822 /// <param name="px">X coordinate for patches 0..12</param>
850 /// <param name="py">Y coordinate for patches 0..15</param> 823 /// <param name="py">Y coordinate for patches 0..15</param>
851 // private void SendLayerPacket(float[] map, int y, int x) 824 private void SendLayerPacket(int x, int y, float[] map)
852 // { 825 {
853 // int[] patches = new int[4]; 826 int[] patches = new int[4];
854 // patches[0] = x + 0 + y * 16; 827 patches[0] = x + 0 + y * 16;
855 // patches[1] = x + 1 + y * 16; 828 patches[1] = x + 1 + y * 16;
856 // patches[2] = x + 2 + y * 16; 829 patches[2] = x + 2 + y * 16;
857 // patches[3] = x + 3 + y * 16; 830 patches[3] = x + 3 + y * 16;
858 831
859 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 832 float[] heightmap = (map.Length == 65536) ?
860 // OutPacket(layerpack, ThrottleOutPacketType.Land); 833 map :
861 // } 834 LLHeightFieldMoronize(map);
835
836 try
837 {
838 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
839 OutPacket(layerpack, ThrottleOutPacketType.Land);
840 }
841 catch
842 {
843 for (int px = x ; px < x + 4 ; px++)
844 SendLayerData(px, y, map);
845 }
846 }
862 847
863 /// <summary> 848 /// <summary>
864 /// Sends a specified patch to a client 849 /// Sends a specified patch to a client
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index c773c05..0b05ed9 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -399,6 +399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
399 #region Queue or Send 399 #region Queue or Send
400 400
401 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category); 401 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category);
402 outgoingPacket.Type = type;
402 403
403 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket)) 404 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
404 SendPacketFinal(outgoingPacket); 405 SendPacketFinal(outgoingPacket);
@@ -510,6 +511,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
510 byte flags = buffer.Data[0]; 511 byte flags = buffer.Data[0];
511 bool isResend = (flags & Helpers.MSG_RESENT) != 0; 512 bool isResend = (flags & Helpers.MSG_RESENT) != 0;
512 bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; 513 bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
514 bool sendSynchronous = false;
513 LLUDPClient udpClient = outgoingPacket.Client; 515 LLUDPClient udpClient = outgoingPacket.Client;
514 516
515 if (!udpClient.IsConnected) 517 if (!udpClient.IsConnected)
@@ -565,9 +567,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
565 if (isReliable) 567 if (isReliable)
566 Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength); 568 Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
567 569
568 // Put the UDP payload on the wire 570 //Some packet types need to be sent synchonously.
569 AsyncBeginSend(buffer); 571 //Sorry, i know it's not optimal, but until the LL client
572 //manages packets correctly and re-orders them as required, this is necessary.
573
574 if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate
575 || outgoingPacket.Type == PacketType.ChatFromSimulator
576 || outgoingPacket.Type == PacketType.ObjectUpdate
577 || outgoingPacket.Type == PacketType.LayerData)
578 {
579 sendSynchronous = true;
580 }
570 581
582 // Put the UDP payload on the wire
583 if (sendSynchronous == true)
584 {
585 SyncBeginSend(buffer);
586 }
587 else
588 {
589 AsyncBeginSend(buffer);
590 }
571 // Keep track of when this packet was sent out (right now) 591 // Keep track of when this packet was sent out (right now)
572 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; 592 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue;
573 } 593 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
index d2779ba..63579ac 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
@@ -246,6 +246,24 @@ namespace OpenMetaverse
246 } 246 }
247 } 247 }
248 248
249 public void SyncBeginSend(UDPPacketBuffer buf)
250 {
251 if (!m_shutdownFlag)
252 {
253 try
254 {
255 m_udpSocket.SendTo(
256 buf.Data,
257 0,
258 buf.DataLength,
259 SocketFlags.None,
260 buf.RemoteEndPoint);
261 }
262 catch (SocketException) { }
263 catch (ObjectDisposedException) { }
264 }
265 }
266
249 public void AsyncBeginSend(UDPPacketBuffer buf) 267 public void AsyncBeginSend(UDPPacketBuffer buf)
250 { 268 {
251 if (!m_shutdownFlag) 269 if (!m_shutdownFlag)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
index 1a1a1cb..7dc42d3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.Packets;
31 32
32namespace OpenSim.Region.ClientStack.LindenUDP 33namespace OpenSim.Region.ClientStack.LindenUDP
33{ 34{
@@ -52,7 +53,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
52 public int TickCount; 53 public int TickCount;
53 /// <summary>Category this packet belongs to</summary> 54 /// <summary>Category this packet belongs to</summary>
54 public ThrottleOutPacketType Category; 55 public ThrottleOutPacketType Category;
55 56 /// <summary>The type of packet so its delivery method can be determined</summary>
57 public PacketType Type;
56 /// <summary> 58 /// <summary>
57 /// Default constructor 59 /// Default constructor
58 /// </summary> 60 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 1614b70..7f9e5af 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -164,19 +164,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
164 List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( 164 List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
165 "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); 165 "POST", m_RestURL+"/RetrieveMessages/", client.AgentId);
166 166
167 foreach (GridInstantMessage im in msglist) 167 if (msglist != null)
168 { 168 {
169 // client.SendInstantMessage(im); 169 foreach (GridInstantMessage im in msglist)
170 170 {
171 // Send through scene event manager so all modules get a chance 171 // client.SendInstantMessage(im);
172 // to look at this message before it gets delivered. 172
173 // 173 // Send through scene event manager so all modules get a chance
174 // Needed for proper state management for stored group 174 // to look at this message before it gets delivered.
175 // invitations 175 //
176 // 176 // Needed for proper state management for stored group
177 Scene s = FindScene(client.AgentId); 177 // invitations
178 if (s != null) 178 //
179 s.EventManager.TriggerIncomingInstantMessage(im); 179 Scene s = FindScene(client.AgentId);
180 if (s != null)
181 s.EventManager.TriggerIncomingInstantMessage(im);
182 }
180 } 183 }
181 } 184 }
182 185
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 73d0984..c0fd437 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1064,14 +1064,6 @@ namespace OpenSim.Region.Framework.Scenes
1064 } 1064 }
1065 } 1065 }
1066 1066
1067 /// <summary>
1068 /// Clear all pending updates of parts to clients
1069 /// </summary>
1070 private void ClearUpdateSchedule()
1071 {
1072 m_updateFlag = 0;
1073 }
1074
1075 private void SendObjectPropertiesToClient(UUID AgentID) 1067 private void SendObjectPropertiesToClient(UUID AgentID)
1076 { 1068 {
1077 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); 1069 ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
@@ -2387,8 +2379,8 @@ namespace OpenSim.Region.Framework.Scenes
2387 { 2379 {
2388 const float ROTATION_TOLERANCE = 0.01f; 2380 const float ROTATION_TOLERANCE = 0.01f;
2389 const float VELOCITY_TOLERANCE = 0.001f; 2381 const float VELOCITY_TOLERANCE = 0.001f;
2390 const float POSITION_TOLERANCE = 0.05f; 2382 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
2391 const int TIME_MS_TOLERANCE = 3000; 2383 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
2392 2384
2393 if (m_updateFlag == 1) 2385 if (m_updateFlag == 1)
2394 { 2386 {
@@ -2401,7 +2393,7 @@ namespace OpenSim.Region.Framework.Scenes
2401 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2393 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2402 { 2394 {
2403 AddTerseUpdateToAllAvatars(); 2395 AddTerseUpdateToAllAvatars();
2404 ClearUpdateSchedule(); 2396
2405 2397
2406 // This causes the Scene to 'poll' physical objects every couple of frames 2398 // This causes the Scene to 'poll' physical objects every couple of frames
2407 // bad, so it's been replaced by an event driven method. 2399 // bad, so it's been replaced by an event driven method.
@@ -2419,13 +2411,15 @@ namespace OpenSim.Region.Framework.Scenes
2419 m_lastAngularVelocity = AngularVelocity; 2411 m_lastAngularVelocity = AngularVelocity;
2420 m_lastTerseSent = Environment.TickCount; 2412 m_lastTerseSent = Environment.TickCount;
2421 } 2413 }
2414 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
2415 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
2422 } 2416 }
2423 else 2417 else
2424 { 2418 {
2425 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 2419 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
2426 { 2420 {
2427 AddFullUpdateToAllAvatars(); 2421 AddFullUpdateToAllAvatars();
2428 ClearUpdateSchedule(); 2422 m_updateFlag = 0; //Same here
2429 } 2423 }
2430 } 2424 }
2431 } 2425 }