aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-07-11 02:51:51 +0000
committerAdam Frisby2007-07-11 02:51:51 +0000
commit561b87b303e8e141ef516b8725ebd3c0be8b1122 (patch)
tree8405b6cef57b66a58f31a24c859846085d0b81f7
parentpreliminary inter region communications (between regions in different instanc... (diff)
downloadopensim-SC_OLD-561b87b303e8e141ef516b8725ebd3c0be8b1122.zip
opensim-SC_OLD-561b87b303e8e141ef516b8725ebd3c0be8b1122.tar.gz
opensim-SC_OLD-561b87b303e8e141ef516b8725ebd3c0be8b1122.tar.bz2
opensim-SC_OLD-561b87b303e8e141ef516b8725ebd3c0be8b1122.tar.xz
* Applying dalien's patches from bug#177 and #179
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/General/ClientManager.cs5
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs17
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs25
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs40
-rw-r--r--OpenSim/Region/ClientStack/ClientViewBase.cs3
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs31
-rw-r--r--bin/avatar-texture.datbin268 -> 203 bytes
11 files changed, 106 insertions, 42 deletions
diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs
index 03ad226..b560ca8 100644
--- a/OpenSim/Framework/General/ClientManager.cs
+++ b/OpenSim/Framework/General/ClientManager.cs
@@ -23,6 +23,11 @@ namespace OpenSim.Framework
23 m_clients = new Dictionary<uint, IClientAPI>(); 23 m_clients = new Dictionary<uint, IClientAPI>();
24 } 24 }
25 25
26 public void Remove(uint id)
27 {
28 m_clients.Remove(id);
29 }
30
26 public void Add(uint id, IClientAPI client ) 31 public void Add(uint id, IClientAPI client )
27 { 32 {
28 m_clients.Add( id, client ); 33 m_clients.Add( id, client );
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 7bc8d14..1b0c682 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -147,6 +147,8 @@ namespace OpenSim.Framework.Interfaces
147 147
148 void OutPacket(Packet newPack); 148 void OutPacket(Packet newPack);
149 void SendWearables(AvatarWearable[] wearables); 149 void SendWearables(AvatarWearable[] wearables);
150 void SendStartPingCheck(byte seq);
151 void SendKillObject(ulong regionHandle, uint avatarLocalID);
150 void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId); 152 void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId);
151 void SendRegionHandshake(RegionInfo regionInfo); 153 void SendRegionHandshake(RegionInfo regionInfo);
152 void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 154 void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 48d5b9d..225e906 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -476,6 +476,23 @@ namespace OpenSim.Region.ClientStack
476 OutPacket(money); 476 OutPacket(money);
477 } 477 }
478 478
479 public void SendStartPingCheck(byte seq)
480 {
481 StartPingCheckPacket pc = new StartPingCheckPacket();
482 pc.PingID.PingID = seq;
483 OutPacket(pc);
484 }
485
486 public void SendKillObject(ulong regionHandle, uint avatarLocalID)
487 {
488 KillObjectPacket kill = new KillObjectPacket();
489 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
490 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
491 kill.ObjectData[0].ID = avatarLocalID;
492 OutPacket(kill);
493 }
494
495
479 #region Appearance/ Wearables Methods 496 #region Appearance/ Wearables Methods
480 497
481 /// <summary> 498 /// <summary>
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
index 31ea3eb..e67807e 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
@@ -51,29 +51,8 @@ namespace OpenSim.Region.ClientStack
51 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); 51 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
52 logReply.InventoryData[0].ItemID = LLUUID.Zero; 52 logReply.InventoryData[0].ItemID = LLUUID.Zero;
53 OutPacket(logReply); 53 OutPacket(logReply);
54 //tell all clients to kill our object 54 //
55 KillObjectPacket kill = new KillObjectPacket(); 55 this.KillClient();
56 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
57 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
58 // kill.ObjectData[0].ID = this.ClientAvatar.localid;
59 foreach (ClientView client in m_clientThreads.Values)
60 {
61 client.OutPacket(kill);
62 }
63
64 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
65
66
67 // m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
68 /*lock (m_world.Entities)
69 {
70 m_world.Entities.Remove(this.AgentID);
71 }*/
72 // m_world.RemoveViewerAgent(this);
73 //need to do other cleaning up here too
74 m_clientThreads.Remove(this.CircuitCode);
75 m_networkServer.RemoveClientCircuit(this.CircuitCode);
76 this.ClientThread.Abort();
77 return true; 56 return true;
78 } 57 }
79 58
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 7d924d0..3265898 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack
45 { 45 {
46 if (Pack.Type != PacketType.AgentUpdate) 46 if (Pack.Type != PacketType.AgentUpdate)
47 { 47 {
48 Console.WriteLine("IN: " + Pack.Type.ToString()); 48 Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString());
49 } 49 }
50 } 50 }
51 51
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 52749a1..0fe3884 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -25,6 +25,7 @@
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*/
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Net; 30using System.Net;
30using System.Text; 31using System.Text;
@@ -77,6 +78,11 @@ namespace OpenSim.Region.ClientStack
77 private int cachedtextureserial = 0; 78 private int cachedtextureserial = 0;
78 protected AuthenticateSessionsBase m_authenticateSessionsHandler; 79 protected AuthenticateSessionsBase m_authenticateSessionsHandler;
79 private Encoding enc = Encoding.ASCII; 80 private Encoding enc = Encoding.ASCII;
81 // Dead client detection vars
82 private Timer clientPingTimer;
83 private int packetsReceived = 0;
84 private int probesWithNoIngressPackets = 0;
85 private int lastPacketsReceived = 0;
80 86
81 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions ) 87 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions )
82 { 88 {
@@ -112,15 +118,7 @@ namespace OpenSim.Region.ClientStack
112 118
113 public void KillClient() 119 public void KillClient()
114 { 120 {
115 KillObjectPacket kill = new KillObjectPacket(); 121 clientPingTimer.Stop();
116 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
117 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
118 //kill.ObjectData[0].ID = this.ClientAvatar.localid;
119 foreach (ClientView client in m_clientThreads.Values)
120 {
121 client.OutPacket(kill);
122 }
123
124 this.m_inventoryCache.ClientLeaving(this.AgentID, null); 122 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
125 m_world.RemoveClient(this.AgentId); 123 m_world.RemoveClient(this.AgentId);
126 124
@@ -193,6 +191,9 @@ namespace OpenSim.Region.ClientStack
193 if (nextPacket.Incoming) 191 if (nextPacket.Incoming)
194 { 192 {
195 //is a incoming packet 193 //is a incoming packet
194 if (nextPacket.Packet.Type != PacketType.AgentUpdate) {
195 packetsReceived++;
196 }
196 ProcessInPacket(nextPacket.Packet); 197 ProcessInPacket(nextPacket.Packet);
197 } 198 }
198 else 199 else
@@ -204,10 +205,31 @@ namespace OpenSim.Region.ClientStack
204 } 205 }
205 # endregion 206 # endregion
206 207
208 protected void CheckClientConnectivity(object sender, ElapsedEventArgs e)
209 {
210 if (packetsReceived == lastPacketsReceived) {
211 probesWithNoIngressPackets++;
212 if (probesWithNoIngressPackets > 30) {
213 this.KillClient();
214 } else {
215 // this will normally trigger at least one packet (ping response)
216 SendStartPingCheck(0);
217 }
218 } else {
219 // Something received in the meantime - we can reset the counters
220 probesWithNoIngressPackets = 0;
221 lastPacketsReceived = packetsReceived;
222 }
223 }
224
207 # region Setup 225 # region Setup
208 226
209 protected virtual void InitNewClient() 227 protected virtual void InitNewClient()
210 { 228 {
229 clientPingTimer = new Timer(1000);
230 clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity);
231 clientPingTimer.Enabled = true;
232
211 MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 233 MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
212 this.m_world.AddNewClient(this, false); 234 this.m_world.AddNewClient(this, false);
213 } 235 }
diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs
index ec7b039..048f4df 100644
--- a/OpenSim/Region/ClientStack/ClientViewBase.cs
+++ b/OpenSim/Region/ClientStack/ClientViewBase.cs
@@ -71,8 +71,7 @@ namespace OpenSim.Region.ClientStack
71 // Keep track of when this packet was sent out 71 // Keep track of when this packet was sent out
72 Pack.TickCount = Environment.TickCount; 72 Pack.TickCount = Environment.TickCount;
73 73
74 74 Console.WriteLine(CircuitCode + ":OUT: " + Pack.Type.ToString());
75 // Console.WriteLine("OUT: " + Pack.Type.ToString());
76 75
77 if (!Pack.Header.Resent) 76 if (!Pack.Header.Resent)
78 { 77 {
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index c7ca315..a88c682 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -178,6 +178,7 @@ namespace OpenSim.Region.ClientStack
178 public virtual void RemoveClientCircuit(uint circuitcode) 178 public virtual void RemoveClientCircuit(uint circuitcode)
179 { 179 {
180 this._networkHandler.RemoveClientCircuit(circuitcode); 180 this._networkHandler.RemoveClientCircuit(circuitcode);
181 this.m_clientManager.Remove(circuitcode);
181 } 182 }
182 } 183 }
183} 184}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index cd81384..d1f6038 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -546,6 +546,28 @@ namespace OpenSim.Region.Environment.Scenes
546 { 546 {
547 eventManager.TriggerOnRemovePresence(agentID); 547 eventManager.TriggerOnRemovePresence(agentID);
548 548
549 ScenePresence avatar = this.RequestAvatar(agentID);
550
551 m_clientManager.ForEachClient(
552 delegate(IClientAPI client)
553 {
554 client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
555 });
556
557 lock (Avatars) {
558 if (Avatars.ContainsKey(agentID)) {
559 Avatars.Remove(agentID);
560 }
561 }
562 lock (Entities) {
563 if (Entities.ContainsKey(agentID)) {
564 Entities.Remove(agentID);
565 }
566 }
567 // TODO: Add the removal from physics ?
568
569
570
549 return; 571 return;
550 } 572 }
551 #endregion 573 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 7330bc5..e65ab7c 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -91,6 +91,12 @@ namespace OpenSim.Region.Environment.Scenes
91 return _physActor; 91 return _physActor;
92 } 92 }
93 } 93 }
94
95 public ulong RegionHandle
96 {
97 get { return m_regionHandle; }
98 }
99
94 #endregion 100 #endregion
95 101
96 #region Constructor(s) 102 #region Constructor(s)
@@ -390,6 +396,16 @@ namespace OpenSim.Region.Environment.Scenes
390 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture); 396 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos, DefaultTexture);
391 } 397 }
392 398
399 public void SendFullUpdateToALLClients()
400 {
401 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
402 foreach (ScenePresence avatar in this.m_world.RequestAvatarList())
403 {
404 this.SendFullUpdateToOtherClient(avatar);
405 avatar.SendFullUpdateToOtherClient(this);
406 }
407 }
408
393 /// <summary> 409 /// <summary>
394 /// 410 ///
395 /// </summary> 411 /// </summary>
@@ -410,6 +426,7 @@ namespace OpenSim.Region.Environment.Scenes
410 public void SendOurAppearance(IClientAPI OurClient) 426 public void SendOurAppearance(IClientAPI OurClient)
411 { 427 {
412 this.ControllingClient.SendWearables(this.Wearables); 428 this.ControllingClient.SendWearables(this.Wearables);
429 this.SendFullUpdateToALLClients();
413 this.m_world.SendAllSceneObjectsToClient(this.ControllingClient); 430 this.m_world.SendAllSceneObjectsToClient(this.ControllingClient);
414 } 431 }
415 432
@@ -429,13 +446,13 @@ namespace OpenSim.Region.Environment.Scenes
429 /// <param name="seq"></param> 446 /// <param name="seq"></param>
430 public void SendAnimPack(LLUUID animID, int seq) 447 public void SendAnimPack(LLUUID animID, int seq)
431 { 448 {
432 this.current_anim = animID; 449 this.current_anim = animID;
433 this.anim_seq = anim_seq; 450 this.anim_seq = seq;
434 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 451 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
435 for (int i = 0; i < avatars.Count; i++) 452 for (int i = 0; i < avatars.Count; i++)
436 { 453 {
437 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); 454 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
438 } 455 }
439 } 456 }
440 457
441 /// <summary> 458 /// <summary>
diff --git a/bin/avatar-texture.dat b/bin/avatar-texture.dat
index 6548a8a..09765be 100644
--- a/bin/avatar-texture.dat
+++ b/bin/avatar-texture.dat
Binary files differ