diff options
author | Mike Mazur | 2009-02-25 00:32:26 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-25 00:32:26 +0000 |
commit | bdf95e54a2da5b60e7817d748f7389289a59bc5e (patch) | |
tree | e688db1880284466aef41abb545dc9ed50ea66cc | |
parent | Setting svn:eol-style=native on new files. (diff) | |
download | opensim-SC-bdf95e54a2da5b60e7817d748f7389289a59bc5e.zip opensim-SC-bdf95e54a2da5b60e7817d748f7389289a59bc5e.tar.gz opensim-SC-bdf95e54a2da5b60e7817d748f7389289a59bc5e.tar.bz2 opensim-SC-bdf95e54a2da5b60e7817d748f7389289a59bc5e.tar.xz |
A few updates necessary for load balancer.
- handle GetUser request for nonexistent user gracefully
- include throttle levels in ClientInfo
- code to save/restore throttles in client stack
- only update/send updates to active clients
- make animation classes serializable
-rw-r--r-- | OpenSim/Framework/ClientInfo.cs | 11 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserManager.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | 59 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/AnimationSet.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 23 |
9 files changed, 92 insertions, 43 deletions
diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs index 7771f67..fbd18b5 100644 --- a/OpenSim/Framework/ClientInfo.cs +++ b/OpenSim/Framework/ClientInfo.cs | |||
@@ -45,5 +45,14 @@ namespace OpenSim.Framework | |||
45 | public uint sequence; | 45 | public uint sequence; |
46 | public byte[] usecircuit; | 46 | public byte[] usecircuit; |
47 | public EndPoint userEP; | 47 | public EndPoint userEP; |
48 | |||
49 | public int resendThrottle; | ||
50 | public int landThrottle; | ||
51 | public int windThrottle; | ||
52 | public int cloudThrottle; | ||
53 | public int taskThrottle; | ||
54 | public int assetThrottle; | ||
55 | public int textureThrottle; | ||
56 | public int totalThrottle; | ||
48 | } | 57 | } |
49 | } \ No newline at end of file | 58 | } |
diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index c6c3a1a..1f4b07d 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs | |||
@@ -248,6 +248,9 @@ namespace OpenSim.Grid.UserServer.Modules | |||
248 | { | 248 | { |
249 | string query = (string) requestData["avatar_name"]; | 249 | string query = (string) requestData["avatar_name"]; |
250 | 250 | ||
251 | if (null == query) | ||
252 | return CreateUnknownUserErrorResponse(); | ||
253 | |||
251 | // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); | 254 | // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); |
252 | 255 | ||
253 | string[] querysplit = query.Split(' '); | 256 | string[] querysplit = query.Split(' '); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f3e3d4f..2f3f198 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -561,8 +561,12 @@ namespace OpenSim | |||
561 | { | 561 | { |
562 | int port = regionInfo.InternalEndPoint.Port; | 562 | int port = regionInfo.InternalEndPoint.Port; |
563 | 563 | ||
564 | // set initial originRegionID to RegionID in RegionInfo. (it needs for loding prims) | 564 | // set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims) |
565 | regionInfo.originRegionID = regionInfo.RegionID; | 565 | // Commented this out because otherwise regions can't register with |
566 | // the grid as there is already another region with the same UUID | ||
567 | // at those coordinates. This is required for the load balancer to work. | ||
568 | // --Mike, 2009.02.25 | ||
569 | //regionInfo.originRegionID = regionInfo.RegionID; | ||
566 | 570 | ||
567 | // set initial ServerURI | 571 | // set initial ServerURI |
568 | regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; | 572 | regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e643a0e..825e87a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -2584,6 +2584,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2584 | 2584 | ||
2585 | public void SendCoarseLocationUpdate(List<Vector3> CoarseLocations) | 2585 | public void SendCoarseLocationUpdate(List<Vector3> CoarseLocations) |
2586 | { | 2586 | { |
2587 | if (!IsActive) return; // We don't need to update inactive clients. | ||
2588 | |||
2587 | CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); | 2589 | CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); |
2588 | // TODO: don't create new blocks if recycling an old packet | 2590 | // TODO: don't create new blocks if recycling an old packet |
2589 | int total = CoarseLocations.Count; | 2591 | int total = CoarseLocations.Count; |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index 23118a2..4270222 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | |||
@@ -196,13 +196,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
196 | // configuration! | 196 | // configuration! |
197 | // | 197 | // |
198 | 198 | ||
199 | if ((m_SynchronizeClient != null) && (!m_Client.IsActive)) | ||
200 | { | ||
201 | if (m_SynchronizeClient(m_Client.Scene, packet, | ||
202 | m_Client.AgentId, throttlePacketType)) | ||
203 | return; | ||
204 | } | ||
205 | |||
206 | packet.Header.Sequence = 0; | 199 | packet.Header.Sequence = 0; |
207 | 200 | ||
208 | lock (m_NeedAck) | 201 | lock (m_NeedAck) |
@@ -480,11 +473,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
480 | if (packet == null) | 473 | if (packet == null) |
481 | return; | 474 | return; |
482 | 475 | ||
483 | // If this client is on another partial instance, no need | 476 | // When too many acks are needed to be sent, the client sends |
484 | // to handle packets | 477 | // a packet consisting of acks only |
485 | // | 478 | // |
486 | if (!m_Client.IsActive && packet.Type != PacketType.LogoutRequest) | 479 | if (packet.Type == PacketType.PacketAck) |
487 | { | 480 | { |
481 | PacketAckPacket ackPacket = (PacketAckPacket)packet; | ||
482 | |||
483 | foreach (PacketAckPacket.PacketsBlock block in | ||
484 | ackPacket.Packets) | ||
485 | { | ||
486 | ProcessAck(block.ID); | ||
487 | } | ||
488 | |||
488 | PacketPool.Instance.ReturnPacket(packet); | 489 | PacketPool.Instance.ReturnPacket(packet); |
489 | return; | 490 | return; |
490 | } | 491 | } |
@@ -500,26 +501,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
500 | } | 501 | } |
501 | } | 502 | } |
502 | 503 | ||
503 | // When too many acks are needed to be sent, the client sends | 504 | // If this client is on another partial instance, no need |
504 | // a packet consisting of acks only | 505 | // to handle packets |
505 | // | 506 | // |
506 | if (packet.Type == PacketType.PacketAck) | 507 | if (!m_Client.IsActive && packet.Type != PacketType.LogoutRequest) |
507 | { | 508 | { |
508 | PacketAckPacket ackPacket = (PacketAckPacket)packet; | ||
509 | |||
510 | foreach (PacketAckPacket.PacketsBlock block in | ||
511 | ackPacket.Packets) | ||
512 | { | ||
513 | ProcessAck(block.ID); | ||
514 | } | ||
515 | |||
516 | PacketPool.Instance.ReturnPacket(packet); | 509 | PacketPool.Instance.ReturnPacket(packet); |
517 | return; | 510 | return; |
518 | } | 511 | } |
519 | else if (packet.Type == PacketType.StartPingCheck) | 512 | |
513 | if (packet.Type == PacketType.StartPingCheck) | ||
520 | { | 514 | { |
521 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; | 515 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; |
522 | CompletePingCheckPacket endPing | 516 | CompletePingCheckPacket endPing |
523 | = (CompletePingCheckPacket)PacketPool.Instance.GetPacket(PacketType.CompletePingCheck); | 517 | = (CompletePingCheckPacket)PacketPool.Instance.GetPacket(PacketType.CompletePingCheck); |
524 | 518 | ||
525 | endPing.PingID.PingID = startPing.PingID.PingID; | 519 | endPing.PingID.PingID = startPing.PingID.PingID; |
@@ -639,6 +633,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
639 | 633 | ||
640 | info.sequence = m_Sequence; | 634 | info.sequence = m_Sequence; |
641 | 635 | ||
636 | float multiplier = m_PacketQueue.ThrottleMultiplier; | ||
637 | info.resendThrottle = (int) (m_PacketQueue.ResendThrottle.Throttle / multiplier); | ||
638 | info.landThrottle = (int) (m_PacketQueue.LandThrottle.Throttle / multiplier); | ||
639 | info.windThrottle = (int) (m_PacketQueue.WindThrottle.Throttle / multiplier); | ||
640 | info.cloudThrottle = (int) (m_PacketQueue.CloudThrottle.Throttle / multiplier); | ||
641 | info.taskThrottle = (int) (m_PacketQueue.TaskThrottle.Throttle / multiplier); | ||
642 | info.assetThrottle = (int) (m_PacketQueue.AssetThrottle.Throttle / multiplier); | ||
643 | info.textureThrottle = (int) (m_PacketQueue.TextureThrottle.Throttle / multiplier); | ||
644 | info.totalThrottle = (int) (m_PacketQueue.TotalThrottle.Throttle / multiplier); | ||
645 | |||
642 | return info; | 646 | return info; |
643 | } | 647 | } |
644 | 648 | ||
@@ -676,6 +680,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
676 | } | 680 | } |
677 | 681 | ||
678 | m_Sequence = info.sequence; | 682 | m_Sequence = info.sequence; |
683 | |||
684 | m_PacketQueue.ResendThrottle.Throttle = info.resendThrottle; | ||
685 | m_PacketQueue.LandThrottle.Throttle = info.landThrottle; | ||
686 | m_PacketQueue.WindThrottle.Throttle = info.windThrottle; | ||
687 | m_PacketQueue.CloudThrottle.Throttle = info.cloudThrottle; | ||
688 | m_PacketQueue.TaskThrottle.Throttle = info.taskThrottle; | ||
689 | m_PacketQueue.AssetThrottle.Throttle = info.assetThrottle; | ||
690 | m_PacketQueue.TextureThrottle.Throttle = info.textureThrottle; | ||
691 | m_PacketQueue.TotalThrottle.Throttle = info.totalThrottle; | ||
679 | } | 692 | } |
680 | 693 | ||
681 | public void AddImportantPacket(PacketType type) | 694 | public void AddImportantPacket(PacketType type) |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 1c398d9..6bfa864 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |||
@@ -69,18 +69,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
69 | // This value also determines how many times per throttletimems the timer will run | 69 | // This value also determines how many times per throttletimems the timer will run |
70 | // If throttleimems is 1000 ms, then the timer will fire every 1000/7 milliseconds | 70 | // If throttleimems is 1000 ms, then the timer will fire every 1000/7 milliseconds |
71 | 71 | ||
72 | private float throttleMultiplier = 2.0f; // Default value really doesn't matter. | ||
72 | private int throttleTimeDivisor = 7; | 73 | private int throttleTimeDivisor = 7; |
73 | 74 | ||
74 | private int throttletimems = 1000; | 75 | private int throttletimems = 1000; |
75 | 76 | ||
76 | private LLPacketThrottle ResendThrottle; | 77 | internal LLPacketThrottle ResendThrottle; |
77 | private LLPacketThrottle LandThrottle; | 78 | internal LLPacketThrottle LandThrottle; |
78 | private LLPacketThrottle WindThrottle; | 79 | internal LLPacketThrottle WindThrottle; |
79 | private LLPacketThrottle CloudThrottle; | 80 | internal LLPacketThrottle CloudThrottle; |
80 | private LLPacketThrottle TaskThrottle; | 81 | internal LLPacketThrottle TaskThrottle; |
81 | private LLPacketThrottle AssetThrottle; | 82 | internal LLPacketThrottle AssetThrottle; |
82 | private LLPacketThrottle TextureThrottle; | 83 | internal LLPacketThrottle TextureThrottle; |
83 | private LLPacketThrottle TotalThrottle; | 84 | internal LLPacketThrottle TotalThrottle; |
84 | 85 | ||
85 | // private long LastThrottle; | 86 | // private long LastThrottle; |
86 | // private long ThrottleInterval; | 87 | // private long ThrottleInterval; |
@@ -108,6 +109,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
108 | TextureOutgoingPacketQueue = new Queue<LLQueItem>(); | 109 | TextureOutgoingPacketQueue = new Queue<LLQueItem>(); |
109 | AssetOutgoingPacketQueue = new Queue<LLQueItem>(); | 110 | AssetOutgoingPacketQueue = new Queue<LLQueItem>(); |
110 | 111 | ||
112 | // Store the throttle multiplier for posterity. | ||
113 | throttleMultiplier = userSettings.ClientThrottleMultipler; | ||
114 | |||
111 | // Set up the throttle classes (min, max, current) in bits per second | 115 | // Set up the throttle classes (min, max, current) in bits per second |
112 | ResendThrottle = new LLPacketThrottle(5000, 100000, 16000, userSettings.ClientThrottleMultipler); | 116 | ResendThrottle = new LLPacketThrottle(5000, 100000, 16000, userSettings.ClientThrottleMultipler); |
113 | LandThrottle = new LLPacketThrottle(1000, 100000, 2000, userSettings.ClientThrottleMultipler); | 117 | LandThrottle = new LLPacketThrottle(1000, 100000, 2000, userSettings.ClientThrottleMultipler); |
@@ -624,5 +628,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
624 | { | 628 | { |
625 | return SendQueue.GetQueueArray(); | 629 | return SendQueue.GetQueueArray(); |
626 | } | 630 | } |
631 | |||
632 | public float ThrottleMultiplier | ||
633 | { | ||
634 | get { return throttleMultiplier; } | ||
635 | } | ||
627 | } | 636 | } |
628 | } | 637 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Animation.cs b/OpenSim/Region/Framework/Scenes/Animation.cs index 7c3e010..1e697bd 100644 --- a/OpenSim/Region/Framework/Scenes/Animation.cs +++ b/OpenSim/Region/Framework/Scenes/Animation.cs | |||
@@ -25,11 +25,13 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenMetaverse.StructuredData; | 30 | using OpenMetaverse.StructuredData; |
30 | 31 | ||
31 | namespace OpenSim.Region.Framework.Scenes | 32 | namespace OpenSim.Region.Framework.Scenes |
32 | { | 33 | { |
34 | [Serializable] | ||
33 | public class Animation | 35 | public class Animation |
34 | { | 36 | { |
35 | private UUID animID; | 37 | private UUID animID; |
diff --git a/OpenSim/Region/Framework/Scenes/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/AnimationSet.cs index ab65166..8e25954 100644 --- a/OpenSim/Region/Framework/Scenes/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/AnimationSet.cs | |||
@@ -25,11 +25,13 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | 31 | ||
31 | namespace OpenSim.Region.Framework.Scenes | 32 | namespace OpenSim.Region.Framework.Scenes |
32 | { | 33 | { |
34 | [Serializable] | ||
33 | public class AnimationSet | 35 | public class AnimationSet |
34 | { | 36 | { |
35 | public static AvatarAnimations Animations = new AvatarAnimations(); | 37 | public static AvatarAnimations Animations = new AvatarAnimations(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6fade39..db0a2d2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2048,17 +2048,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2048 | /// <param name="remoteClient"></param> | 2048 | /// <param name="remoteClient"></param> |
2049 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | 2049 | public void SendTerseUpdateToClient(IClientAPI remoteClient) |
2050 | { | 2050 | { |
2051 | m_perfMonMS = System.Environment.TickCount; | 2051 | // If the client is inactive, it's getting its updates from another |
2052 | // server. | ||
2053 | if (remoteClient.IsActive) | ||
2054 | { | ||
2055 | m_perfMonMS = System.Environment.TickCount; | ||
2052 | 2056 | ||
2053 | Vector3 pos = m_pos; | 2057 | Vector3 pos = m_pos; |
2054 | Vector3 vel = Velocity; | 2058 | Vector3 vel = Velocity; |
2055 | Quaternion rot = m_bodyRot; | 2059 | Quaternion rot = m_bodyRot; |
2056 | pos.Z -= m_appearance.HipOffset; | 2060 | pos.Z -= m_appearance.HipOffset; |
2057 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), | 2061 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), |
2058 | new Vector3(vel.X, vel.Y, vel.Z), rot); | 2062 | new Vector3(vel.X, vel.Y, vel.Z), rot); |
2059 | 2063 | ||
2060 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 2064 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
2061 | m_scene.AddAgentUpdates(1); | 2065 | m_scene.AddAgentUpdates(1); |
2066 | } | ||
2062 | } | 2067 | } |
2063 | 2068 | ||
2064 | /// <summary> | 2069 | /// <summary> |