aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2010-12-21 19:15:44 -0500
committerTeravus Ovares (Dan Olivares)2010-12-21 19:15:44 -0500
commit25ecd62b1feed16d12d6f5e5ef00bddf7dbf0547 (patch)
tree6da8a5c79266eb5dc1e36baaf95ee1f0c8531f42 /OpenSim
parentWhat is the point of using different types to express the same damn thing? (diff)
downloadopensim-SC_OLD-25ecd62b1feed16d12d6f5e5ef00bddf7dbf0547.zip
opensim-SC_OLD-25ecd62b1feed16d12d6f5e5ef00bddf7dbf0547.tar.gz
opensim-SC_OLD-25ecd62b1feed16d12d6f5e5ef00bddf7dbf0547.tar.bz2
opensim-SC_OLD-25ecd62b1feed16d12d6f5e5ef00bddf7dbf0547.tar.xz
* Adds AbortXfer to the ClientAPI mix
* Adds an item that checks to see if the top request has been there for longer then 30 seconds without an update and sends an AbortXfer if it encounters one. This allows the client to cancel the Xfer on it's side so you can re-select the prim and get the inventory when it fails the first time. * Some interesting locking... Using NewFiles to lock the rest of them. We'll see how that goes. * The goal of this is to ensure that Xfers are restartable when they fail. The client will not do that on it's own.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs6
-rw-r--r--OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs5
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-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
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs5
9 files changed, 106 insertions, 4 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index 19331c6..a66caab 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -1116,6 +1116,12 @@ namespace OpenSim.Client.MXP.ClientStack
1116 // SL Specific, Ignore. (Remove from IClient) 1116 // SL Specific, Ignore. (Remove from IClient)
1117 } 1117 }
1118 1118
1119 public void SendAbortXferPacket(ulong xferID)
1120 {
1121
1122 }
1123
1124
1119 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) 1125 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)
1120 { 1126 {
1121 // SL Specific, Ignore. (Remove from IClient) 1127 // SL Specific, Ignore. (Remove from IClient)
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
index 0d23232..c8eca9f 100644
--- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
+++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
@@ -669,6 +669,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
669 throw new System.NotImplementedException(); 669 throw new System.NotImplementedException();
670 } 670 }
671 671
672 public virtual void SendAbortXferPacket(ulong xferID)
673 {
674 throw new System.NotImplementedException();
675 }
676
672 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) 677 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)
673 { 678 {
674 throw new System.NotImplementedException(); 679 throw new System.NotImplementedException();
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index b9c9323..6bca6eb 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1057,6 +1057,8 @@ namespace OpenSim.Framework
1057 1057
1058 void SendXferPacket(ulong xferID, uint packet, byte[] data); 1058 void SendXferPacket(ulong xferID, uint packet, byte[] data);
1059 1059
1060 void SendAbortXferPacket(ulong xferID);
1061
1060 void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, 1062 void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
1061 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, 1063 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent,
1062 float PriceObjectScaleFactor, 1064 float PriceObjectScaleFactor,
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 63469c8..929f282 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2078,6 +2078,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2078 OutPacket(sendXfer, ThrottleOutPacketType.Asset); 2078 OutPacket(sendXfer, ThrottleOutPacketType.Asset);
2079 } 2079 }
2080 2080
2081 public void SendAbortXferPacket(ulong xferID)
2082 {
2083 AbortXferPacket xferItem = (AbortXferPacket)PacketPool.Instance.GetPacket(PacketType.AbortXfer);
2084 xferItem.XferID.ID = xferID;
2085 OutPacket(xferItem, ThrottleOutPacketType.Asset);
2086 }
2087
2081 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, 2088 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
2082 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, 2089 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
2083 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, 2090 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 f128aa2..311352c 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 fc17192..20870aa 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1117,6 +1117,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1117 1117
1118 } 1118 }
1119 1119
1120 public void SendAbortXferPacket(ulong xferID)
1121 {
1122
1123 }
1124
1120 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) 1125 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)
1121 { 1126 {
1122 1127
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 6928c4e..0c43c8a 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,
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index b2c8b35..3f3845c 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -696,6 +696,11 @@ namespace OpenSim.Tests.Common.Mock
696 { 696 {
697 } 697 }
698 698
699 public virtual void SendAbortXferPacket(ulong xferID)
700 {
701
702 }
703
699 public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, 704 public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
700 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, 705 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
701 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, 706 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,