aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs4
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs526
3 files changed, 267 insertions, 267 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index 488cae4..9b5a9b6 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Data.NHibernate
107 { 107 {
108 return session.Load(typeof(AssetBase), uuid) as AssetBase; 108 return session.Load(typeof(AssetBase), uuid) as AssetBase;
109 } 109 }
110 catch (ObjectNotFoundException e) 110 catch (ObjectNotFoundException)
111 { 111 {
112 m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid); 112 m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid);
113 return null; 113 return null;
@@ -125,7 +125,7 @@ namespace OpenSim.Data.NHibernate
125 { 125 {
126 AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase; 126 AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase;
127 } 127 }
128 catch (ObjectNotFoundException e) 128 catch (ObjectNotFoundException)
129 { 129 {
130 session.Save(asset); 130 session.Save(asset);
131 session.Flush(); 131 session.Flush();
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 55331d5..f6c67f5 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -125,7 +125,7 @@ namespace OpenSim.Data.NHibernate
125 session.Update(p); 125 session.Update(p);
126 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID); 126 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID);
127 } 127 }
128 catch (ObjectNotFoundException e) 128 catch (ObjectNotFoundException)
129 { 129 {
130 m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID); 130 m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID);
131 session.Save(p); 131 session.Save(p);
@@ -145,7 +145,7 @@ namespace OpenSim.Data.NHibernate
145 session.Update(t); 145 session.Update(t);
146 session.Flush(); 146 session.Flush();
147 } 147 }
148 catch (ObjectNotFoundException e) 148 catch (ObjectNotFoundException)
149 { 149 {
150 session.Save(t); 150 session.Save(t);
151 session.Flush(); 151 session.Flush();
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs
index ce9c527..690fadb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs
@@ -1,263 +1,263 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Threading; 4using System.Threading;
5using libsecondlife; 5using libsecondlife;
6using libsecondlife.Packets; 6using libsecondlife.Packets;
7using OpenSim.Framework; 7using OpenSim.Framework;
8 8
9namespace OpenSim.Region.ClientStack.LindenUDP 9namespace OpenSim.Region.ClientStack.LindenUDP
10{ 10{
11 11
12 public class LLPacketTracker 12 public class LLPacketTracker
13 { 13 {
14 public delegate void PacketAcked(uint sequenceNumber); 14 public delegate void PacketAcked(uint sequenceNumber);
15 public event PacketAcked OnPacketAcked; 15 public event PacketAcked OnPacketAcked;
16 16
17 protected List<uint> m_beenAcked = new List<uint>(); 17 protected List<uint> m_beenAcked = new List<uint>();
18 18
19 protected TerrainPacketTracker[,] m_sentTerrainPackets = new TerrainPacketTracker[16, 16]; 19 protected TerrainPacketTracker[,] m_sentTerrainPackets = new TerrainPacketTracker[16, 16];
20 protected Dictionary<LLUUID, PrimPacketTracker> m_sendPrimPackets = new Dictionary<LLUUID, PrimPacketTracker>(); 20 protected Dictionary<LLUUID, PrimPacketTracker> m_sendPrimPackets = new Dictionary<LLUUID, PrimPacketTracker>();
21 21
22 protected LLClientView m_parentClient; 22 protected LLClientView m_parentClient;
23 23
24 public LLPacketTracker(LLClientView parent) 24 public LLPacketTracker(LLClientView parent)
25 { 25 {
26 m_parentClient = parent; 26 m_parentClient = parent;
27 OnPacketAcked += TerrainPacketAcked; 27 OnPacketAcked += TerrainPacketAcked;
28 //OnPacketAcked += PrimPacketAcked; 28 //OnPacketAcked += PrimPacketAcked;
29 } 29 }
30 30
31 public void PacketAck(uint sequenceNumber) 31 public void PacketAck(uint sequenceNumber)
32 { 32 {
33 lock (m_beenAcked) 33 lock (m_beenAcked)
34 { 34 {
35 m_beenAcked.Add(sequenceNumber); 35 m_beenAcked.Add(sequenceNumber);
36 } 36 }
37 } 37 }
38 38
39 public void TrackTerrainPacket(uint sequenceNumber, int patchX, int patchY) 39 public void TrackTerrainPacket(uint sequenceNumber, int patchX, int patchY)
40 { 40 {
41 TrackTerrainPacket(sequenceNumber, patchX, patchY, false, null); 41 TrackTerrainPacket(sequenceNumber, patchX, patchY, false, null);
42 } 42 }
43 43
44 public void TrackTerrainPacket(uint sequenceNumber, int patchX, int patchY, bool keepResending, LayerDataPacket packet) 44 public void TrackTerrainPacket(uint sequenceNumber, int patchX, int patchY, bool keepResending, LayerDataPacket packet)
45 { 45 {
46 TerrainPacketTracker tracker = new TerrainPacketTracker(); 46 TerrainPacketTracker tracker = new TerrainPacketTracker();
47 tracker.X = patchX; 47 tracker.X = patchX;
48 tracker.Y = patchY; 48 tracker.Y = patchY;
49 tracker.SeqNumber = sequenceNumber; 49 tracker.SeqNumber = sequenceNumber;
50 tracker.TimeSent = DateTime.Now; 50 tracker.TimeSent = DateTime.Now;
51 tracker.KeepResending = keepResending; 51 tracker.KeepResending = keepResending;
52 tracker.Packet = packet; 52 tracker.Packet = packet;
53 lock (m_sentTerrainPackets) 53 lock (m_sentTerrainPackets)
54 { 54 {
55 m_sentTerrainPackets[patchX, patchY] = tracker; 55 m_sentTerrainPackets[patchX, patchY] = tracker;
56 } 56 }
57 } 57 }
58 58
59 public void TrackPrimPacket(uint sequenceNumber, LLUUID primID) 59 public void TrackPrimPacket(uint sequenceNumber, LLUUID primID)
60 { 60 {
61 PrimPacketTracker tracker = new PrimPacketTracker(); 61 PrimPacketTracker tracker = new PrimPacketTracker();
62 tracker.PrimID = primID; 62 tracker.PrimID = primID;
63 tracker.TimeSent = DateTime.Now; 63 tracker.TimeSent = DateTime.Now;
64 tracker.SeqNumber = sequenceNumber; 64 tracker.SeqNumber = sequenceNumber;
65 lock (m_sendPrimPackets) 65 lock (m_sendPrimPackets)
66 { 66 {
67 m_sendPrimPackets[primID] = tracker; 67 m_sendPrimPackets[primID] = tracker;
68 } 68 }
69 } 69 }
70 70
71 public void TerrainPacketCheck() 71 public void TerrainPacketCheck()
72 { 72 {
73 DateTime now = DateTime.Now; 73 DateTime now = DateTime.Now;
74 List<TerrainPacketTracker> resendList = new List<TerrainPacketTracker>(); 74 List<TerrainPacketTracker> resendList = new List<TerrainPacketTracker>();
75 lock (m_sentTerrainPackets) 75 lock (m_sentTerrainPackets)
76 { 76 {
77 for (int y = 0; y < 16; y++) 77 for (int y = 0; y < 16; y++)
78 { 78 {
79 for (int x = 0; x < 16; x++) 79 for (int x = 0; x < 16; x++)
80 { 80 {
81 if (m_sentTerrainPackets[x, y] != null) 81 if (m_sentTerrainPackets[x, y] != null)
82 { 82 {
83 TerrainPacketTracker tracker = m_sentTerrainPackets[x, y]; 83 TerrainPacketTracker tracker = m_sentTerrainPackets[x, y];
84 if ((now - tracker.TimeSent) > TimeSpan.FromMinutes(1)) 84 if ((now - tracker.TimeSent) > TimeSpan.FromMinutes(1))
85 { 85 {
86 tracker.TimeSent = now; 86 tracker.TimeSent = now;
87 m_sentTerrainPackets[x, y] = null; 87 m_sentTerrainPackets[x, y] = null;
88 resendList.Add(tracker); 88 resendList.Add(tracker);
89 } 89 }
90 } 90 }
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 foreach (TerrainPacketTracker tracker in resendList) 95 foreach (TerrainPacketTracker tracker in resendList)
96 { 96 {
97 if (!tracker.KeepResending) 97 if (!tracker.KeepResending)
98 { 98 {
99 m_parentClient.TriggerTerrainUnackedEvent(tracker.X, tracker.Y); 99 m_parentClient.TriggerTerrainUnackedEvent(tracker.X, tracker.Y);
100 } 100 }
101 else 101 else
102 { 102 {
103 if (tracker.Packet != null) 103 if (tracker.Packet != null)
104 { 104 {
105 tracker.Packet.Header.Resent = true; 105 tracker.Packet.Header.Resent = true;
106 m_parentClient.OutPacket(tracker.Packet, ThrottleOutPacketType.Resend); 106 m_parentClient.OutPacket(tracker.Packet, ThrottleOutPacketType.Resend);
107 tracker.TimeSent = DateTime.Now; 107 tracker.TimeSent = DateTime.Now;
108 lock (m_sentTerrainPackets) 108 lock (m_sentTerrainPackets)
109 { 109 {
110 if (m_sentTerrainPackets[tracker.X, tracker.Y] == null) 110 if (m_sentTerrainPackets[tracker.X, tracker.Y] == null)
111 { 111 {
112 m_sentTerrainPackets[tracker.X, tracker.Y] = tracker; 112 m_sentTerrainPackets[tracker.X, tracker.Y] = tracker;
113 } 113 }
114 } 114 }
115 } 115 }
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 public void PrimPacketCheck() 120 public void PrimPacketCheck()
121 { 121 {
122 DateTime now = DateTime.Now; 122 DateTime now = DateTime.Now;
123 List<PrimPacketTracker> resendList = new List<PrimPacketTracker>(); 123 List<PrimPacketTracker> resendList = new List<PrimPacketTracker>();
124 List<PrimPacketTracker> ackedList = new List<PrimPacketTracker>(); 124 List<PrimPacketTracker> ackedList = new List<PrimPacketTracker>();
125 125
126 lock (m_sendPrimPackets) 126 lock (m_sendPrimPackets)
127 { 127 {
128 foreach (PrimPacketTracker tracker in m_sendPrimPackets.Values) 128 foreach (PrimPacketTracker tracker in m_sendPrimPackets.Values)
129 { 129 {
130 if (tracker.Acked) 130 if (tracker.Acked)
131 { 131 {
132 ackedList.Add(tracker); 132 ackedList.Add(tracker);
133 } 133 }
134 else if (((now - tracker.TimeSent) > TimeSpan.FromMinutes(1)) && (!tracker.Acked)) 134 else if (((now - tracker.TimeSent) > TimeSpan.FromMinutes(1)) && (!tracker.Acked))
135 { 135 {
136 resendList.Add(tracker); 136 resendList.Add(tracker);
137 } 137 }
138 } 138 }
139 } 139 }
140 140
141 foreach (PrimPacketTracker tracker in resendList) 141 foreach (PrimPacketTracker tracker in resendList)
142 { 142 {
143 lock (m_sendPrimPackets) 143 lock (m_sendPrimPackets)
144 { 144 {
145 m_sendPrimPackets.Remove(tracker.PrimID); 145 m_sendPrimPackets.Remove(tracker.PrimID);
146 } 146 }
147 //call event 147 //call event
148 Console.WriteLine("Prim packet not acked, " + tracker.PrimID.ToString()); 148 Console.WriteLine("Prim packet not acked, " + tracker.PrimID.ToString());
149 } 149 }
150 150
151 151
152 RemovePrimTrackers(ackedList); 152 RemovePrimTrackers(ackedList);
153 } 153 }
154 154
155 public void PrimTrackerCleanup() 155 public void PrimTrackerCleanup()
156 { 156 {
157 List<PrimPacketTracker> ackedList = new List<PrimPacketTracker>(); 157 List<PrimPacketTracker> ackedList = new List<PrimPacketTracker>();
158 158
159 lock (m_sendPrimPackets) 159 lock (m_sendPrimPackets)
160 { 160 {
161 foreach (PrimPacketTracker tracker in m_sendPrimPackets.Values) 161 foreach (PrimPacketTracker tracker in m_sendPrimPackets.Values)
162 { 162 {
163 if (tracker.Acked) 163 if (tracker.Acked)
164 { 164 {
165 ackedList.Add(tracker); 165 ackedList.Add(tracker);
166 } 166 }
167 } 167 }
168 } 168 }
169 Thread.Sleep(15); //give a little bit of time for other code to access list before we lock it again 169 Thread.Sleep(15); //give a little bit of time for other code to access list before we lock it again
170 170
171 RemovePrimTrackers(ackedList); 171 RemovePrimTrackers(ackedList);
172 } 172 }
173 173
174 protected void RemovePrimTrackers(List<PrimPacketTracker> ackedList) 174 protected void RemovePrimTrackers(List<PrimPacketTracker> ackedList)
175 { 175 {
176 lock (m_sendPrimPackets) 176 lock (m_sendPrimPackets)
177 { 177 {
178 foreach (PrimPacketTracker tracker in ackedList) 178 foreach (PrimPacketTracker tracker in ackedList)
179 { 179 {
180 m_sendPrimPackets.Remove(tracker.PrimID); 180 m_sendPrimPackets.Remove(tracker.PrimID);
181 } 181 }
182 } 182 }
183 } 183 }
184 184
185 protected void TerrainPacketAcked(uint sequence) 185 protected void TerrainPacketAcked(uint sequence)
186 { 186 {
187 lock (m_sentTerrainPackets) 187 lock (m_sentTerrainPackets)
188 { 188 {
189 for (int y = 0; y < 16; y++) 189 for (int y = 0; y < 16; y++)
190 { 190 {
191 for (int x = 0; x < 16; x++) 191 for (int x = 0; x < 16; x++)
192 { 192 {
193 if (m_sentTerrainPackets[x, y] != null) 193 if (m_sentTerrainPackets[x, y] != null)
194 { 194 {
195 if (m_sentTerrainPackets[x, y].SeqNumber == sequence) 195 if (m_sentTerrainPackets[x, y].SeqNumber == sequence)
196 { 196 {
197 m_sentTerrainPackets[x, y] = null; 197 m_sentTerrainPackets[x, y] = null;
198 return; 198 return;
199 } 199 }
200 } 200 }
201 } 201 }
202 } 202 }
203 } 203 }
204 } 204 }
205 205
206 protected void PrimPacketAcked(uint sequence) 206 protected void PrimPacketAcked(uint sequence)
207 { 207 {
208 lock (m_sendPrimPackets) 208 lock (m_sendPrimPackets)
209 { 209 {
210 foreach (PrimPacketTracker tracker in m_sendPrimPackets.Values) 210 foreach (PrimPacketTracker tracker in m_sendPrimPackets.Values)
211 { 211 {
212 if (tracker.SeqNumber == sequence) 212 if (tracker.SeqNumber == sequence)
213 { 213 {
214 tracker.Acked = true; 214 tracker.Acked = true;
215 break; 215 break;
216 } 216 }
217 } 217 }
218 } 218 }
219 } 219 }
220 220
221 public void Process() 221 public void Process()
222 { 222 {
223 List<uint> ackedPackets = null; 223 List<uint> ackedPackets = null;
224 lock (m_beenAcked) 224 lock (m_beenAcked)
225 { 225 {
226 ackedPackets = new List<uint>(m_beenAcked); 226 ackedPackets = new List<uint>(m_beenAcked);
227 m_beenAcked.Clear(); 227 m_beenAcked.Clear();
228 } 228 }
229 229
230 if (ackedPackets != null) 230 if (ackedPackets != null)
231 { 231 {
232 foreach (uint packetId in ackedPackets) 232 foreach (uint packetId in ackedPackets)
233 { 233 {
234 if (OnPacketAcked != null) 234 if (OnPacketAcked != null)
235 { 235 {
236 OnPacketAcked(packetId); 236 OnPacketAcked(packetId);
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 // ackedPackets.Clear(); 241 // ackedPackets.Clear();
242 ackedPackets = null; 242 ackedPackets = null;
243 } 243 }
244 244
245 public class TerrainPacketTracker 245 public class TerrainPacketTracker
246 { 246 {
247 public uint SeqNumber = 0; 247 public uint SeqNumber = 0;
248 public int X; 248 public int X;
249 public int Y; 249 public int Y;
250 public DateTime TimeSent; 250 public DateTime TimeSent;
251 public LayerDataPacket Packet; 251 public LayerDataPacket Packet;
252 public bool KeepResending; 252 public bool KeepResending;
253 } 253 }
254 254
255 public class PrimPacketTracker 255 public class PrimPacketTracker
256 { 256 {
257 public uint SeqNumber = 0; 257 public uint SeqNumber = 0;
258 public DateTime TimeSent; 258 public DateTime TimeSent;
259 public LLUUID PrimID; 259 public LLUUID PrimID;
260 public bool Acked = false; 260 public bool Acked = false;
261 } 261 }
262 } 262 }
263} 263}