aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/PacketPool.cs
diff options
context:
space:
mode:
authorTom2011-09-04 07:06:36 -0700
committerTom2011-09-04 07:06:36 -0700
commit66dec3b8742eff04fbbcc6e3249fe4ba87986500 (patch)
tree76cc708a821d35fac5cdbbce2de304b47064e732 /OpenSim/Framework/PacketPool.cs
parentGuard another nullref (diff)
parentFixed BulletSim config files for Linux *.so libraries. (diff)
downloadopensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.zip
opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.gz
opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.bz2
opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.xz
Resolve merge commits, stage 1
Diffstat (limited to 'OpenSim/Framework/PacketPool.cs')
-rw-r--r--OpenSim/Framework/PacketPool.cs17
1 files changed, 11 insertions, 6 deletions
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs
index 7e2860e..41d17c5 100644
--- a/OpenSim/Framework/PacketPool.cs
+++ b/OpenSim/Framework/PacketPool.cs
@@ -144,6 +144,7 @@ namespace OpenSim.Framework
144 m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type); 144 m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type);
145 else 145 else
146 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); 146 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer);
147
147 return packet; 148 return packet;
148 } 149 }
149 150
@@ -160,19 +161,18 @@ namespace OpenSim.Framework
160 case PacketType.ObjectUpdate: 161 case PacketType.ObjectUpdate:
161 ObjectUpdatePacket oup = (ObjectUpdatePacket)packet; 162 ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
162 163
163 foreach (ObjectUpdatePacket.ObjectDataBlock oupod in 164 foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData)
164 oup.ObjectData)
165 ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod); 165 ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod);
166
166 oup.ObjectData = null; 167 oup.ObjectData = null;
167 break; 168 break;
168 169
169 case PacketType.ImprovedTerseObjectUpdate: 170 case PacketType.ImprovedTerseObjectUpdate:
170 ImprovedTerseObjectUpdatePacket itoup = 171 ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
171 (ImprovedTerseObjectUpdatePacket)packet;
172 172
173 foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock 173 foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData)
174 itoupod in itoup.ObjectData)
175 ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod); 174 ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod);
175
176 itoup.ObjectData = null; 176 itoup.ObjectData = null;
177 break; 177 break;
178 } 178 }
@@ -194,6 +194,7 @@ namespace OpenSim.Framework
194 { 194 {
195 pool[type] = new Stack<Packet>(); 195 pool[type] = new Stack<Packet>();
196 } 196 }
197
197 if ((pool[type]).Count < 50) 198 if ((pool[type]).Count < 50)
198 { 199 {
199 (pool[type]).Push(packet); 200 (pool[type]).Push(packet);
@@ -223,6 +224,7 @@ namespace OpenSim.Framework
223 { 224 {
224 DataBlocks[typeof(T)] = new Stack<Object>(); 225 DataBlocks[typeof(T)] = new Stack<Object>();
225 } 226 }
227
226 return new T(); 228 return new T();
227 } 229 }
228 } 230 }
@@ -234,6 +236,9 @@ namespace OpenSim.Framework
234 236
235 lock (DataBlocks) 237 lock (DataBlocks)
236 { 238 {
239 if (!DataBlocks.ContainsKey(typeof(T)))
240 DataBlocks[typeof(T)] = new Stack<Object>();
241
237 if (DataBlocks[typeof(T)].Count < 50) 242 if (DataBlocks[typeof(T)].Count < 50)
238 DataBlocks[typeof(T)].Push(block); 243 DataBlocks[typeof(T)].Push(block);
239 } 244 }