aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorJeff Ames2007-12-19 08:44:25 +0000
committerJeff Ames2007-12-19 08:44:25 +0000
commit6702b0373371fd2a546a580ad82f5cc175fa29e0 (patch)
treef2750d5be494d2a976cb583476c4f32ef3d895d7 /OpenSim/Region/ClientStack
parent*Added Ban Lines around parcels for banned avatars, but there is no actual bl... (diff)
downloadopensim-SC_OLD-6702b0373371fd2a546a580ad82f5cc175fa29e0.zip
opensim-SC_OLD-6702b0373371fd2a546a580ad82f5cc175fa29e0.tar.gz
opensim-SC_OLD-6702b0373371fd2a546a580ad82f5cc175fa29e0.tar.bz2
opensim-SC_OLD-6702b0373371fd2a546a580ad82f5cc175fa29e0.tar.xz
Misc. cleanup:
* added Util.Clip(value, min, max) * modified asset cache's numPackets calculation to use max packet size (600) instead of 1000 * removed a few magic numbers
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs29
1 files changed, 6 insertions, 23 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 3c35270..75c4187 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -102,7 +102,6 @@ namespace OpenSim.Region.ClientStack
102 protected LLVector3 m_startpos; 102 protected LLVector3 m_startpos;
103 protected EndPoint m_userEndPoint; 103 protected EndPoint m_userEndPoint;
104 104
105
106 /* Properties */ 105 /* Properties */
107 public LLUUID SecureSessionId 106 public LLUUID SecureSessionId
108 { 107 {
@@ -181,7 +180,7 @@ namespace OpenSim.Region.ClientStack
181 180
182 // While working on this, the BlockingQueue had me fooled for a bit. 181 // While working on this, the BlockingQueue had me fooled for a bit.
183 // The Blocking queue causes the thread to stop until there's something 182 // The Blocking queue causes the thread to stop until there's something
184 // in it to process. it's an on-purpose threadlock though because 183 // in it to process. It's an on-purpose threadlock though because
185 // without it, the clientloop will suck up all sim resources. 184 // without it, the clientloop will suck up all sim resources.
186 185
187 m_packetQueue = new PacketQueue(); 186 m_packetQueue = new PacketQueue();
@@ -193,7 +192,6 @@ namespace OpenSim.Region.ClientStack
193 m_clientThread.Start(); 192 m_clientThread.Start();
194 } 193 }
195 194
196
197 public void SetDebug(int newDebug) 195 public void SetDebug(int newDebug)
198 { 196 {
199 m_debug = newDebug; 197 m_debug = newDebug;
@@ -236,10 +234,8 @@ namespace OpenSim.Region.ClientStack
236 public void Kick(string message) 234 public void Kick(string message)
237 { 235 {
238 KickUserPacket kupack = new KickUserPacket(); 236 KickUserPacket kupack = new KickUserPacket();
239
240 kupack.UserInfo.AgentID = AgentId; 237 kupack.UserInfo.AgentID = AgentId;
241 kupack.UserInfo.SessionID = SessionId; 238 kupack.UserInfo.SessionID = SessionId;
242
243 kupack.TargetBlock.TargetIP = (uint)0; 239 kupack.TargetBlock.TargetIP = (uint)0;
244 kupack.TargetBlock.TargetPort = (ushort)0; 240 kupack.TargetBlock.TargetPort = (ushort)0;
245 kupack.UserInfo.Reason = Helpers.StringToField(message); 241 kupack.UserInfo.Reason = Helpers.StringToField(message);
@@ -345,7 +341,6 @@ namespace OpenSim.Region.ClientStack
345 QueItem nextPacket = m_packetQueue.Dequeue(); 341 QueItem nextPacket = m_packetQueue.Dequeue();
346 if (nextPacket.Incoming) 342 if (nextPacket.Incoming)
347 { 343 {
348 //is a incoming packet
349 if (nextPacket.Packet.Type != PacketType.AgentUpdate) 344 if (nextPacket.Packet.Type != PacketType.AgentUpdate)
350 { 345 {
351 m_packetsReceived++; 346 m_packetsReceived++;
@@ -532,7 +527,6 @@ namespace OpenSim.Region.ClientStack
532 public event RegionInfoRequest OnRegionInfoRequest; 527 public event RegionInfoRequest OnRegionInfoRequest;
533 public event EstateCovenantRequest OnEstateCovenantRequest; 528 public event EstateCovenantRequest OnEstateCovenantRequest;
534 529
535
536 #region Scene/Avatar to Client 530 #region Scene/Avatar to Client
537 531
538 /// <summary> 532 /// <summary>
@@ -611,7 +605,6 @@ namespace OpenSim.Region.ClientStack
611 SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID); 605 SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
612 } 606 }
613 607
614
615 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 608 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
616 { 609 {
617 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); 610 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
@@ -666,7 +659,7 @@ namespace OpenSim.Region.ClientStack
666 659
667 for (int y = 0; y < 16; y++) 660 for (int y = 0; y < 16; y++)
668 { 661 {
669 for (int x = 0; x < 16; x = x + 4) 662 for (int x = 0; x < 16; x += 4)
670 { 663 {
671 patches[0] = x + 0 + y*16; 664 patches[0] = x + 0 + y*16;
672 patches[1] = x + 1 + y*16; 665 patches[1] = x + 1 + y*16;
@@ -766,7 +759,6 @@ namespace OpenSim.Region.ClientStack
766 newSimPack.Info = new CrossedRegionPacket.InfoBlock(); 759 newSimPack.Info = new CrossedRegionPacket.InfoBlock();
767 newSimPack.Info.Position = pos; 760 newSimPack.Info.Position = pos;
768 newSimPack.Info.LookAt = look; 761 newSimPack.Info.LookAt = look;
769 // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
770 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); 762 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock();
771 newSimPack.RegionData.RegionHandle = newRegionHandle; 763 newSimPack.RegionData.RegionHandle = newRegionHandle;
772 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); 764 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes();
@@ -775,7 +767,6 @@ namespace OpenSim.Region.ClientStack
775 newSimPack.RegionData.SimIP += (uint) byteIP[1] << 8; 767 newSimPack.RegionData.SimIP += (uint) byteIP[1] << 8;
776 newSimPack.RegionData.SimIP += (uint) byteIP[0]; 768 newSimPack.RegionData.SimIP += (uint) byteIP[0];
777 newSimPack.RegionData.SimPort = (ushort) externalIPEndPoint.Port; 769 newSimPack.RegionData.SimPort = (ushort) externalIPEndPoint.Port;
778 //newSimPack.RegionData.SeedCapability = new byte[0];
779 newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); 770 newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL);
780 771
781 OutPacket(newSimPack, ThrottleOutPacketType.Task); 772 OutPacket(newSimPack, ThrottleOutPacketType.Task);
@@ -823,7 +814,6 @@ namespace OpenSim.Region.ClientStack
823 teleport.Info.SimAccess = simAccess; 814 teleport.Info.SimAccess = simAccess;
824 815
825 teleport.Info.SeedCapability = Helpers.StringToField(capsURL); 816 teleport.Info.SeedCapability = Helpers.StringToField(capsURL);
826 //teleport.Info.SeedCapability = new byte[0];
827 817
828 IPAddress oIP = newRegionEndPoint.Address; 818 IPAddress oIP = newRegionEndPoint.Address;
829 byte[] byteIP = oIP.GetAddressBytes(); 819 byte[] byteIP = oIP.GetAddressBytes();
@@ -847,7 +837,6 @@ namespace OpenSim.Region.ClientStack
847 TeleportFailedPacket tpFailed = new TeleportFailedPacket(); 837 TeleportFailedPacket tpFailed = new TeleportFailedPacket();
848 tpFailed.Info.AgentID = this.AgentId; 838 tpFailed.Info.AgentID = this.AgentId;
849 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); 839 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
850
851 OutPacket(tpFailed, ThrottleOutPacketType.Task); 840 OutPacket(tpFailed, ThrottleOutPacketType.Task);
852 } 841 }
853 842
@@ -946,7 +935,6 @@ namespace OpenSim.Region.ClientStack
946 descend.ItemData[i].SaleType = 0; 935 descend.ItemData[i].SaleType = 0;
947 descend.ItemData[i].Type = (sbyte)item.assetType; 936 descend.ItemData[i].Type = (sbyte)item.assetType;
948 descend.ItemData[i].CRC = 937 descend.ItemData[i].CRC =
949
950 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, 938 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
951 descend.ItemData[i].InvType, descend.ItemData[i].Type, 939 descend.ItemData[i].InvType, descend.ItemData[i].Type,
952 descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, descend.ItemData[i].SalePrice, 940 descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, descend.ItemData[i].SalePrice,
@@ -1228,7 +1216,7 @@ namespace OpenSim.Region.ClientStack
1228 Console.WriteLine("SunPhase: {0}", phase); 1216 Console.WriteLine("SunPhase: {0}", phase);
1229 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); 1217 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
1230 //viewertime.TimeInfo.SecPerDay = 86400; 1218 //viewertime.TimeInfo.SecPerDay = 86400;
1231 // viewertime.TimeInfo.SecPerYear = 31536000; 1219 //viewertime.TimeInfo.SecPerYear = 31536000;
1232 viewertime.TimeInfo.SecPerDay = 1000; 1220 viewertime.TimeInfo.SecPerDay = 1000;
1233 viewertime.TimeInfo.SecPerYear = 365000; 1221 viewertime.TimeInfo.SecPerYear = 365000;
1234 viewertime.TimeInfo.SunPhase = 1; 1222 viewertime.TimeInfo.SunPhase = 1;
@@ -1252,14 +1240,9 @@ namespace OpenSim.Region.ClientStack
1252 { 1240 {
1253 yValue = yValue - 1.2f; 1241 yValue = yValue - 1.2f;
1254 } 1242 }
1255 if (yValue > 1) 1243
1256 { 1244 yValue = Util.Clip(yValue, 0, 1);
1257 yValue = 1; 1245
1258 }
1259 if (yValue < 0)
1260 {
1261 yValue = 0;
1262 }
1263 if (sunPhase < 14) 1246 if (sunPhase < 14)
1264 { 1247 {
1265 yValue = 1 - yValue; 1248 yValue = 1 - yValue;