aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.PacketQueue.cs')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketQueue.cs39
1 files changed, 20 insertions, 19 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
index 5cd30ce..efeff29 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
@@ -32,13 +32,12 @@ using System.Net.Sockets;
32using System.Timers; 32using System.Timers;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.Packets; 34using libsecondlife.Packets;
35using OpenSim.Framework.Console;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Environment; 36using OpenSim.Framework.Console;
38 37
39namespace OpenSim.Region.ClientStack 38namespace OpenSim.Region.ClientStack
40{ 39{
41 public partial class ClientView 40 public partial class ClientView
42 { 41 {
43 protected BlockingQueue<QueItem> PacketQueue; 42 protected BlockingQueue<QueItem> PacketQueue;
44 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 43 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
@@ -84,7 +83,7 @@ namespace OpenSim.Region.ClientStack
84 Pack.Header.Sequence = Sequence; 83 Pack.Header.Sequence = Sequence;
85 } 84 }
86 85
87 if (Pack.Header.Reliable) //DIRTY HACK 86 if (Pack.Header.Reliable) //DIRTY HACK
88 { 87 {
89 lock (NeedAck) 88 lock (NeedAck)
90 { 89 {
@@ -148,19 +147,21 @@ namespace OpenSim.Region.ClientStack
148 if (Pack.Header.Zerocoded) 147 if (Pack.Header.Zerocoded)
149 { 148 {
150 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 149 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
151 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);//userEP); 150 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); //userEP);
152 } 151 }
153 else 152 else
154 { 153 {
155 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); //userEP); 154 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
155 //userEP);
156 } 156 }
157 } 157 }
158 catch (Exception) 158 catch (Exception)
159 { 159 {
160 MainLog.Instance.Warn("client", "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); 160 MainLog.Instance.Warn("client",
161 this.KillThread(); 161 "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " +
162 userEP.ToString() + " - killing thread");
163 KillThread();
162 } 164 }
163
164 } 165 }
165 166
166 public virtual void InPacket(Packet NewPack) 167 public virtual void InPacket(Packet NewPack)
@@ -180,7 +181,7 @@ namespace OpenSim.Region.ClientStack
180 // Handle PacketAck packets 181 // Handle PacketAck packets
181 if (NewPack.Type == PacketType.PacketAck) 182 if (NewPack.Type == PacketType.PacketAck)
182 { 183 {
183 PacketAckPacket ackPacket = (PacketAckPacket)NewPack; 184 PacketAckPacket ackPacket = (PacketAckPacket) NewPack;
184 185
185 lock (NeedAck) 186 lock (NeedAck)
186 { 187 {
@@ -193,7 +194,7 @@ namespace OpenSim.Region.ClientStack
193 else if ((NewPack.Type == PacketType.StartPingCheck)) 194 else if ((NewPack.Type == PacketType.StartPingCheck))
194 { 195 {
195 //reply to pingcheck 196 //reply to pingcheck
196 StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack; 197 StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack;
197 CompletePingCheckPacket endPing = new CompletePingCheckPacket(); 198 CompletePingCheckPacket endPing = new CompletePingCheckPacket();
198 endPing.PingID.PingID = startPing.PingID.PingID; 199 endPing.PingID.PingID = startPing.PingID.PingID;
199 OutPacket(endPing); 200 OutPacket(endPing);
@@ -203,9 +204,8 @@ namespace OpenSim.Region.ClientStack
203 QueItem item = new QueItem(); 204 QueItem item = new QueItem();
204 item.Packet = NewPack; 205 item.Packet = NewPack;
205 item.Incoming = true; 206 item.Incoming = true;
206 this.PacketQueue.Enqueue(item); 207 PacketQueue.Enqueue(item);
207 } 208 }
208
209 } 209 }
210 210
211 public virtual void OutPacket(Packet NewPack) 211 public virtual void OutPacket(Packet NewPack)
@@ -213,7 +213,7 @@ namespace OpenSim.Region.ClientStack
213 QueItem item = new QueItem(); 213 QueItem item = new QueItem();
214 item.Packet = NewPack; 214 item.Packet = NewPack;
215 item.Incoming = false; 215 item.Incoming = false;
216 this.PacketQueue.Enqueue(item); 216 PacketQueue.Enqueue(item);
217 } 217 }
218 218
219 # region Low Level Packet Methods 219 # region Low Level Packet Methods
@@ -229,7 +229,6 @@ namespace OpenSim.Region.ClientStack
229 ack_it.Header.Reliable = false; 229 ack_it.Header.Reliable = false;
230 230
231 OutPacket(ack_it); 231 OutPacket(ack_it);
232
233 } 232 }
234 /* 233 /*
235 if (Pack.Header.Reliable) 234 if (Pack.Header.Reliable)
@@ -252,8 +251,8 @@ namespace OpenSim.Region.ClientStack
252 { 251 {
253 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) 252 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
254 { 253 {
255 MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + 254 MainLog.Instance.Verbose("Resending " + packet.Type.ToString() + " packet, " +
256 (now - packet.TickCount) + "ms have passed"); 255 (now - packet.TickCount) + "ms have passed");
257 256
258 packet.Header.Resent = true; 257 packet.Header.Resent = true;
259 OutPacket(packet); 258 OutPacket(packet);
@@ -271,7 +270,7 @@ namespace OpenSim.Region.ClientStack
271 if (PendingAcks.Count > 250) 270 if (PendingAcks.Count > 250)
272 { 271 {
273 // FIXME: Handle the odd case where we have too many pending ACKs queued up 272 // FIXME: Handle the odd case where we have too many pending ACKs queued up
274 MainLog.Instance.Verbose( "Too many ACKs queued up!"); 273 MainLog.Instance.Verbose("Too many ACKs queued up!");
275 return; 274 return;
276 } 275 }
277 276
@@ -302,6 +301,7 @@ namespace OpenSim.Region.ClientStack
302 SendAcks(); 301 SendAcks();
303 ResendUnacked(); 302 ResendUnacked();
304 } 303 }
304
305 #endregion 305 #endregion
306 306
307 #region Nested Classes 307 #region Nested Classes
@@ -315,6 +315,7 @@ namespace OpenSim.Region.ClientStack
315 public Packet Packet; 315 public Packet Packet;
316 public bool Incoming; 316 public bool Incoming;
317 } 317 }
318
318 #endregion 319 #endregion
319 } 320 }
320} 321} \ No newline at end of file