diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AssetBase.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Capabilities/Caps.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/IMoneyModule.cs | 30 | ||||
-rw-r--r-- | OpenSim/Framework/ParcelMediaCommandEnum.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/UndoStack.cs | 58 |
8 files changed, 58 insertions, 62 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 53d28be..98fa846 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -60,6 +60,8 @@ namespace OpenSim.Framework | |||
60 | /// </summary> | 60 | /// </summary> |
61 | private AssetMetadata m_metadata; | 61 | private AssetMetadata m_metadata; |
62 | 62 | ||
63 | private int m_uploadAttempts; | ||
64 | |||
63 | // This is needed for .NET serialization!!! | 65 | // This is needed for .NET serialization!!! |
64 | // Do NOT "Optimize" away! | 66 | // Do NOT "Optimize" away! |
65 | public AssetBase() | 67 | public AssetBase() |
@@ -197,6 +199,12 @@ namespace OpenSim.Framework | |||
197 | set { m_metadata.Type = value; } | 199 | set { m_metadata.Type = value; } |
198 | } | 200 | } |
199 | 201 | ||
202 | public int UploadAttempts | ||
203 | { | ||
204 | get { return m_uploadAttempts; } | ||
205 | set { m_uploadAttempts = value; } | ||
206 | } | ||
207 | |||
200 | /// <summary> | 208 | /// <summary> |
201 | /// Is this a region only asset, or does this exist on the asset server also | 209 | /// Is this a region only asset, or does this exist on the asset server also |
202 | /// </summary> | 210 | /// </summary> |
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 62a1e17..da953bb 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities | |||
814 | 814 | ||
815 | if (mm != null) | 815 | if (mm != null) |
816 | { | 816 | { |
817 | if (!mm.UploadCovered(client)) | 817 | if (!mm.UploadCovered(client, mm.UploadCharge)) |
818 | { | 818 | { |
819 | if (client != null) | 819 | if (client != null) |
820 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | 820 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 3480960..3d4873d 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs | |||
@@ -35,35 +35,15 @@ namespace OpenSim.Framework | |||
35 | bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, | 35 | bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, |
36 | int amount); | 36 | int amount); |
37 | 37 | ||
38 | int GetBalance(IClientAPI client); | 38 | int GetBalance(UUID agentID); |
39 | void ApplyUploadCharge(UUID agentID); | 39 | bool UploadCovered(IClientAPI client, int amount); |
40 | bool UploadCovered(IClientAPI client); | ||
41 | void ApplyGroupCreationCharge(UUID agentID); | ||
42 | bool GroupCreationCovered(IClientAPI client); | ||
43 | bool AmountCovered(IClientAPI client, int amount); | 40 | bool AmountCovered(IClientAPI client, int amount); |
44 | void ApplyCharge(UUID agentID, int amount, string text); | 41 | void ApplyCharge(UUID agentID, int amount, string text); |
42 | void ApplyUploadCharge(UUID agentID, int amount, string text); | ||
45 | 43 | ||
46 | EconomyData GetEconomyData(); | 44 | int UploadCharge { get; } |
45 | int GroupCreationCharge { get; } | ||
47 | 46 | ||
48 | event ObjectPaid OnObjectPaid; | 47 | event ObjectPaid OnObjectPaid; |
49 | } | 48 | } |
50 | |||
51 | public struct EconomyData | ||
52 | { | ||
53 | public int ObjectCapacity; | ||
54 | public int ObjectCount; | ||
55 | public int PriceEnergyUnit; | ||
56 | public int PriceGroupCreate; | ||
57 | public int PriceObjectClaim; | ||
58 | public float PriceObjectRent; | ||
59 | public float PriceObjectScaleFactor; | ||
60 | public int PriceParcelClaim; | ||
61 | public float PriceParcelClaimFactor; | ||
62 | public int PriceParcelRent; | ||
63 | public int PricePublicObjectDecay; | ||
64 | public int PricePublicObjectDelete; | ||
65 | public int PriceRentLight; | ||
66 | public int PriceUpload; | ||
67 | public int TeleportMinPrice; | ||
68 | } | ||
69 | } | 49 | } |
diff --git a/OpenSim/Framework/ParcelMediaCommandEnum.cs b/OpenSim/Framework/ParcelMediaCommandEnum.cs index 93c41ec..e714382 100644 --- a/OpenSim/Framework/ParcelMediaCommandEnum.cs +++ b/OpenSim/Framework/ParcelMediaCommandEnum.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | namespace OpenSim.Framework | 28 | namespace OpenSim.Framework |
29 | { | 29 | { |
30 | public enum ParcelMediaCommandEnum | 30 | public enum ParcelMediaCommandEnum : int |
31 | { | 31 | { |
32 | Stop = 0, | 32 | Stop = 0, |
33 | Pause = 1, | 33 | Pause = 1, |
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 4d1de22..990c859 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -1196,7 +1196,7 @@ namespace OpenSim.Framework | |||
1196 | prim.Textures = this.Textures; | 1196 | prim.Textures = this.Textures; |
1197 | 1197 | ||
1198 | prim.Properties = new Primitive.ObjectProperties(); | 1198 | prim.Properties = new Primitive.ObjectProperties(); |
1199 | prim.Properties.Name = "Primitive"; | 1199 | prim.Properties.Name = "Object"; |
1200 | prim.Properties.Description = ""; | 1200 | prim.Properties.Description = ""; |
1201 | prim.Properties.CreatorID = UUID.Zero; | 1201 | prim.Properties.CreatorID = UUID.Zero; |
1202 | prim.Properties.GroupID = UUID.Zero; | 1202 | prim.Properties.GroupID = UUID.Zero; |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index afc4060..2a74e79 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Framework.Console; | |||
40 | 40 | ||
41 | namespace OpenSim.Framework | 41 | namespace OpenSim.Framework |
42 | { | 42 | { |
43 | [Serializable] | ||
43 | public class RegionLightShareData : ICloneable | 44 | public class RegionLightShareData : ICloneable |
44 | { | 45 | { |
45 | public UUID regionID = UUID.Zero; | 46 | public UUID regionID = UUID.Zero; |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index eab463c..f07f7ab 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | |||
@@ -57,11 +57,27 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
57 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | 57 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> |
58 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) | 58 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) |
59 | { | 59 | { |
60 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 100); | ||
61 | } | ||
62 | /// <summary> | ||
63 | /// Perform a synchronous REST request. | ||
64 | /// </summary> | ||
65 | /// <param name="verb"></param> | ||
66 | /// <param name="requestUrl"></param> | ||
67 | /// <param name="obj"> </param> | ||
68 | /// <param name="timeout"> </param> | ||
69 | /// <returns></returns> | ||
70 | /// | ||
71 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | ||
72 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
73 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) | ||
74 | { | ||
60 | Type type = typeof (TRequest); | 75 | Type type = typeof (TRequest); |
61 | TResponse deserial = default(TResponse); | 76 | TResponse deserial = default(TResponse); |
62 | 77 | ||
63 | WebRequest request = WebRequest.Create(requestUrl); | 78 | WebRequest request = WebRequest.Create(requestUrl); |
64 | request.Method = verb; | 79 | request.Method = verb; |
80 | request.Timeout = pTimeout * 1000; | ||
65 | 81 | ||
66 | if ((verb == "POST") || (verb == "PUT")) | 82 | if ((verb == "POST") || (verb == "PUT")) |
67 | { | 83 | { |
@@ -81,7 +97,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
81 | 97 | ||
82 | int length = (int) buffer.Length; | 98 | int length = (int) buffer.Length; |
83 | request.ContentLength = length; | 99 | request.ContentLength = length; |
84 | |||
85 | Stream requestStream = null; | 100 | Stream requestStream = null; |
86 | try | 101 | try |
87 | { | 102 | { |
diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs index 4d800ae..4cd779a 100644 --- a/OpenSim/Framework/UndoStack.cs +++ b/OpenSim/Framework/UndoStack.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | 30 | ||
30 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
31 | { | 32 | { |
@@ -36,33 +37,30 @@ namespace OpenSim.Framework | |||
36 | [Serializable] | 37 | [Serializable] |
37 | public class UndoStack<T> | 38 | public class UndoStack<T> |
38 | { | 39 | { |
39 | private int m_new = 1; | 40 | private List<T> m_undolist; |
40 | private int m_old = 0; | 41 | private int m_max; |
41 | private T[] m_Undos; | ||
42 | 42 | ||
43 | public UndoStack(int capacity) | 43 | public UndoStack(int capacity) |
44 | { | 44 | { |
45 | m_Undos = new T[capacity + 1]; | 45 | m_undolist = new List<T>(); |
46 | m_max = capacity; | ||
46 | } | 47 | } |
47 | 48 | ||
48 | public bool IsFull | 49 | public bool IsFull |
49 | { | 50 | { |
50 | get { return m_new == m_old; } | 51 | get { return m_undolist.Count >= m_max; } |
51 | } | 52 | } |
52 | 53 | ||
53 | public int Capacity | 54 | public int Capacity |
54 | { | 55 | { |
55 | get { return m_Undos.Length - 1; } | 56 | get { return m_max; } |
56 | } | 57 | } |
57 | 58 | ||
58 | public int Count | 59 | public int Count |
59 | { | 60 | { |
60 | get | 61 | get |
61 | { | 62 | { |
62 | int count = m_new - m_old - 1; | 63 | return m_undolist.Count; |
63 | if (count < 0) | ||
64 | count += m_Undos.Length; | ||
65 | return count; | ||
66 | } | 64 | } |
67 | } | 65 | } |
68 | 66 | ||
@@ -70,45 +68,39 @@ namespace OpenSim.Framework | |||
70 | { | 68 | { |
71 | if (IsFull) | 69 | if (IsFull) |
72 | { | 70 | { |
73 | m_old++; | 71 | m_undolist.RemoveAt(0); |
74 | if (m_old >= m_Undos.Length) | ||
75 | m_old -= m_Undos.Length; | ||
76 | } | 72 | } |
77 | if (++m_new >= m_Undos.Length) | 73 | m_undolist.Add(item); |
78 | m_new -= m_Undos.Length; | ||
79 | m_Undos[m_new] = item; | ||
80 | } | 74 | } |
81 | 75 | ||
82 | public T Pop() | 76 | public T Pop() |
83 | { | 77 | { |
84 | if (Count > 0) | 78 | if (m_undolist.Count > 0) |
85 | { | 79 | { |
86 | T deleted = m_Undos[m_new]; | 80 | int ind = m_undolist.Count - 1; |
87 | m_Undos[m_new--] = default(T); | 81 | T item = m_undolist[ind]; |
88 | if (m_new < 0) | 82 | m_undolist.RemoveAt(ind); |
89 | m_new += m_Undos.Length; | 83 | return item; |
90 | return deleted; | ||
91 | } | 84 | } |
92 | else | 85 | else |
93 | throw new InvalidOperationException("Cannot pop from emtpy stack"); | 86 | throw new InvalidOperationException("Cannot pop from empty stack"); |
94 | } | 87 | } |
95 | 88 | ||
96 | public T Peek() | 89 | public T Peek() |
97 | { | 90 | { |
98 | return m_Undos[m_new]; | 91 | if (m_undolist.Count > 0) |
92 | { | ||
93 | return m_undolist[m_undolist.Count - 1]; | ||
94 | } | ||
95 | else | ||
96 | { | ||
97 | return default(T); | ||
98 | } | ||
99 | } | 99 | } |
100 | 100 | ||
101 | public void Clear() | 101 | public void Clear() |
102 | { | 102 | { |
103 | if (Count > 0) | 103 | m_undolist.Clear(); |
104 | { | ||
105 | for (int i = 0; i < m_Undos.Length; i++) | ||
106 | { | ||
107 | m_Undos[i] = default(T); | ||
108 | } | ||
109 | m_new = 1; | ||
110 | m_old = 0; | ||
111 | } | ||
112 | } | 104 | } |
113 | } | 105 | } |
114 | } | 106 | } |