aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-12-21 23:09:12 +0000
committerMelanie2010-12-21 23:09:12 +0000
commite9382c293936ff7faa34c5d70db97f24b1339755 (patch)
tree944d15d068d33f0a63110b62fe4f0e598dec3355 /OpenSim/Region
parentMerge branch 'master' into careminster-presence-refactor (diff)
parent* Adds AbortXfer to the ClientAPI mix (diff)
downloadopensim-SC_OLD-e9382c293936ff7faa34c5d70db97f24b1339755.zip
opensim-SC_OLD-e9382c293936ff7faa34c5d70db97f24b1339755.tar.gz
opensim-SC_OLD-e9382c293936ff7faa34c5d70db97f24b1339755.tar.bz2
opensim-SC_OLD-e9382c293936ff7faa34c5d70db97f24b1339755.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs70
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
5 files changed, 88 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 00a605e..6a6bd12 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2097,6 +2097,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2097 OutPacket(sendXfer, ThrottleOutPacketType.Asset); 2097 OutPacket(sendXfer, ThrottleOutPacketType.Asset);
2098 } 2098 }
2099 2099
2100 public void SendAbortXferPacket(ulong xferID)
2101 {
2102 AbortXferPacket xferItem = (AbortXferPacket)PacketPool.Instance.GetPacket(PacketType.AbortXfer);
2103 xferItem.XferID.ID = xferID;
2104 OutPacket(xferItem, ThrottleOutPacketType.Asset);
2105 }
2106
2100 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, 2107 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
2101 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, 2108 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
2102 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, 2109 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
index ef7dce8..57875da 100644
--- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
@@ -97,6 +97,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
97 NewFiles.Add(fileName, data); 97 NewFiles.Add(fileName, data);
98 } 98 }
99 } 99 }
100 string filename = string.Empty;
100 101
101 if (Requests.ContainsKey(fileName)) 102 if (Requests.ContainsKey(fileName))
102 { 103 {
@@ -113,6 +114,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
113 { 114 {
114 client.OnRequestXfer += RequestXfer; 115 client.OnRequestXfer += RequestXfer;
115 client.OnConfirmXfer += AckPacket; 116 client.OnConfirmXfer += AckPacket;
117 client.OnAbortXfer += AbortXfer;
116 } 118 }
117 119
118 /// <summary> 120 /// <summary>
@@ -125,6 +127,17 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
125 { 127 {
126 lock (NewFiles) 128 lock (NewFiles)
127 { 129 {
130 if (RequestTime.Count > 0)
131 {
132 TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks);
133 if (ts.TotalSeconds > 30)
134 {
135 ulong zxferid = RequestTime[0].xferID;
136 remoteClient.SendAbortXferPacket(zxferid);
137 RemoveXferData(zxferid);
138 }
139 }
140
128 if (NewFiles.ContainsKey(fileName)) 141 if (NewFiles.ContainsKey(fileName))
129 { 142 {
130 if (!Transfers.ContainsKey(xferID)) 143 if (!Transfers.ContainsKey(xferID))
@@ -137,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
137 150
138 if (transaction.StartSend()) 151 if (transaction.StartSend())
139 { 152 {
140 Transfers.Remove(xferID); 153 RemoveXferData(xferID);
141 } 154 }
142 } 155 }
143 } 156 }
@@ -150,6 +163,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
150 { 163 {
151 Requests.Remove(RequestTime[0].fileName); 164 Requests.Remove(RequestTime[0].fileName);
152 RequestTime.RemoveAt(0); 165 RequestTime.RemoveAt(0);
166 // Do we want to abort this here?
167 //remoteClient.SendAbortXfer(xferID);
153 } 168 }
154 } 169 }
155 170
@@ -165,22 +180,69 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
165 } 180 }
166 181
167 } 182 }
183
168 } 184 }
169 } 185 }
170 186
171 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) 187 public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
172 { 188 {
173 if (Transfers.ContainsKey(xferID)) 189 lock (NewFiles) // This is actually to lock Transfers
174 { 190 {
175 if (Transfers[xferID].AckPacket(packet)) 191 if (Transfers.ContainsKey(xferID))
176 { 192 {
193 XferDownLoad dl = Transfers[xferID];
194 if (Transfers[xferID].AckPacket(packet))
177 { 195 {
178 Transfers.Remove(xferID); 196 {
197 RemoveXferData(xferID);
198 }
199 }
200 else
201 {
202
203 if (Requests.ContainsKey(dl.FileName))
204 {
205 //
206 XferRequest req = Requests[dl.FileName];
207 req.timeStamp = DateTime.UtcNow;
208 Requests[dl.FileName] = req;
209 }
179 } 210 }
180 } 211 }
181 } 212 }
182 } 213 }
183 214
215 private void RemoveXferData(ulong xferID)
216 {
217 // NewFiles must be locked!
218 if (Transfers.ContainsKey(xferID))
219 {
220 // Qualifier distinguishes between the OpenMetaverse version and the nested class
221
222 XferModule.XferDownLoad xferItem = Transfers[xferID];
223 //string filename = xferItem.FileName;
224 Transfers.Remove(xferID);
225 xferItem.Data = new byte[0]; // Clear the data
226 xferItem.DataPointer = 0;
227
228 // If the abort comes in
229 if (NewFiles.ContainsKey(xferItem.FileName))
230 NewFiles.Remove(xferItem.FileName);
231
232 if (Requests.ContainsKey(xferItem.FileName))
233 Requests.Remove(xferItem.FileName);
234
235 }
236 }
237
238 public void AbortXfer(IClientAPI remoteClient, ulong xferID)
239 {
240 lock (NewFiles)
241 {
242 RemoveXferData(xferID);
243 }
244 }
245
184 #region Nested type: XferDownLoad 246 #region Nested type: XferDownLoad
185 247
186 public class XferDownLoad 248 public class XferDownLoad
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 7441a60..a6e2c03 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -602,6 +602,12 @@ namespace OpenSim.Region.Examples.SimpleModule
602 { 602 {
603 } 603 }
604 604
605 public virtual void SendAbortXferPacket(ulong xferID)
606 {
607
608 }
609
610
605 public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, 611 public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
606 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, 612 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
607 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, 613 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 276e46d..75f6441 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1123,6 +1123,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1123 1123
1124 } 1124 }
1125 1125
1126 public void SendAbortXferPacket(ulong xferID)
1127 {
1128
1129 }
1130
1126 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent) 1131 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
1127 { 1132 {
1128 1133
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 39c3364..51949b4 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -687,6 +687,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
687 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) 687 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
688 { 688 {
689 } 689 }
690 public virtual void SendAbortXferPacket(ulong xferID)
691 {
692
693 }
690 694
691 public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, 695 public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
692 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, 696 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,