aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
6 files changed, 53 insertions, 35 deletions
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}