diff options
author | Justin Clarke Casey | 2008-02-08 23:42:19 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-02-08 23:42:19 +0000 |
commit | 16f8f19a541ab2b32751dbc4307efe419443988a (patch) | |
tree | 2b67361b498ea8b484447c365123406843d6e7d9 /OpenSim/Framework | |
parent | * Added Taper support to the Meshmerizer for Cube and Cylinder. (diff) | |
download | opensim-SC-16f8f19a541ab2b32751dbc4307efe419443988a.zip opensim-SC-16f8f19a541ab2b32751dbc4307efe419443988a.tar.gz opensim-SC-16f8f19a541ab2b32751dbc4307efe419443988a.tar.bz2 opensim-SC-16f8f19a541ab2b32751dbc4307efe419443988a.tar.xz |
* Stop asset transactions hanging around after they've completed
* Still not enough to solve the memory leak, though hopefully this is another step on the path
* All these changes are pretty temporary - this will be addressed with a more fundamental refactor in the future
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs | 20 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetTransactions.cs | 70 |
2 files changed, 79 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs index c9c9541..b458b18 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs | |||
@@ -25,13 +25,19 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | |||
29 | using System; | ||
28 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | |||
29 | using libsecondlife; | 32 | using libsecondlife; |
30 | 33 | ||
31 | namespace OpenSim.Framework.Communications.Cache | 34 | namespace OpenSim.Framework.Communications.Cache |
32 | { | 35 | { |
33 | public class AssetTransactionManager | 36 | public class AssetTransactionManager |
34 | { | 37 | { |
38 | private static readonly log4net.ILog m_log | ||
39 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
35 | // Fields | 41 | // Fields |
36 | public CommunicationsManager CommsManager; | 42 | public CommunicationsManager CommsManager; |
37 | 43 | ||
@@ -92,7 +98,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
92 | AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); | 98 | AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); |
93 | if (uploader != null) | 99 | if (uploader != null) |
94 | { | 100 | { |
95 | uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); | 101 | // Upload has already compelted uploading... |
102 | if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile)) | ||
103 | { | ||
104 | lock (transactions.XferUploaders) | ||
105 | { | ||
106 | // XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary | ||
107 | transactions.XferUploaders.Remove(uploader.TransactionID); | ||
108 | |||
109 | m_log.Info(String.Format("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count)); | ||
110 | } | ||
111 | } | ||
96 | } | 112 | } |
97 | } | 113 | } |
98 | } | 114 | } |
@@ -106,4 +122,4 @@ namespace OpenSim.Framework.Communications.Cache | |||
106 | } | 122 | } |
107 | } | 123 | } |
108 | } | 124 | } |
109 | } \ No newline at end of file | 125 | } |
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs index 4a75f52..c54dd7d 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs | |||
@@ -37,6 +37,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
37 | { | 37 | { |
38 | public class AgentAssetTransactions | 38 | public class AgentAssetTransactions |
39 | { | 39 | { |
40 | private static readonly log4net.ILog m_log | ||
41 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
40 | // Fields | 43 | // Fields |
41 | public List<AssetCapsUploader> CapsUploaders = new List<AssetCapsUploader>(); | 44 | public List<AssetCapsUploader> CapsUploaders = new List<AssetCapsUploader>(); |
42 | public List<NoteCardCapsUpdate> NotecardUpdaters = new List<NoteCardCapsUpdate>(); | 45 | public List<NoteCardCapsUpdate> NotecardUpdaters = new List<NoteCardCapsUpdate>(); |
@@ -73,7 +76,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
73 | { | 76 | { |
74 | AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); | 77 | AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); |
75 | 78 | ||
76 | XferUploaders.Add(transactionID, uploader); | 79 | lock (XferUploaders) |
80 | { | ||
81 | XferUploaders.Add(transactionID, uploader); | ||
82 | } | ||
83 | |||
77 | return uploader; | 84 | return uploader; |
78 | } | 85 | } |
79 | return null; | 86 | return null; |
@@ -81,13 +88,35 @@ namespace OpenSim.Framework.Communications.Cache | |||
81 | 88 | ||
82 | public void HandleXfer(ulong xferID, uint packetID, byte[] data) | 89 | public void HandleXfer(ulong xferID, uint packetID, byte[] data) |
83 | { | 90 | { |
84 | foreach (AssetXferUploader uploader in XferUploaders.Values) | 91 | AssetXferUploader uploaderFound = null; |
92 | |||
93 | lock (XferUploaders) | ||
85 | { | 94 | { |
86 | if (uploader.XferID == xferID) | 95 | foreach (AssetXferUploader uploader in XferUploaders.Values) |
87 | { | 96 | { |
88 | uploader.HandleXferPacket(xferID, packetID, data); | 97 | if (uploader.XferID == xferID) |
89 | break; | 98 | { |
99 | if (uploader.HandleXferPacket(xferID, packetID, data)) | ||
100 | { | ||
101 | uploaderFound = uploader; | ||
102 | } | ||
103 | |||
104 | break; | ||
105 | } | ||
90 | } | 106 | } |
107 | |||
108 | // Remove the uploader once the uploader is complete | ||
109 | if (uploaderFound != null) | ||
110 | { | ||
111 | m_log.Info( | ||
112 | String.Format( | ||
113 | "[ASSET TRANSACTIONS] Removing asset xfer uploader with transfer id {0}, transaction {1}", | ||
114 | xferID, uploaderFound.TransactionID)); | ||
115 | |||
116 | XferUploaders.Remove(uploaderFound.TransactionID); | ||
117 | |||
118 | m_log.Info(String.Format("[ASSET TRANSACTIONS] Current uploaders: {0}", XferUploaders.Count)); | ||
119 | } | ||
91 | } | 120 | } |
92 | } | 121 | } |
93 | 122 | ||
@@ -114,7 +143,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
114 | { | 143 | { |
115 | AssetXferUploader uploader = XferUploaders[transactionID]; | 144 | AssetXferUploader uploader = XferUploaders[transactionID]; |
116 | AssetBase asset = uploader.GetAssetData(); | 145 | AssetBase asset = uploader.GetAssetData(); |
117 | XferUploaders.Remove(transactionID); | 146 | |
147 | lock (XferUploaders) | ||
148 | { | ||
149 | XferUploaders.Remove(transactionID); | ||
150 | } | ||
118 | 151 | ||
119 | return asset; | 152 | return asset; |
120 | } | 153 | } |
@@ -150,8 +183,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
150 | m_dumpAssetToFile = dumpAssetToFile; | 183 | m_dumpAssetToFile = dumpAssetToFile; |
151 | } | 184 | } |
152 | 185 | ||
153 | // Methods | 186 | /// <summary> |
154 | public void HandleXferPacket(ulong xferID, uint packetID, byte[] data) | 187 | /// Process transfer data received from the client. |
188 | /// </summary> | ||
189 | /// <param name="xferID"></param> | ||
190 | /// <param name="packetID"></param> | ||
191 | /// <param name="data"></param> | ||
192 | /// <returns>True if the transfer is complete, false otherwise or if the xferID was not valid</returns> | ||
193 | public bool HandleXferPacket(ulong xferID, uint packetID, byte[] data) | ||
155 | { | 194 | { |
156 | if (XferID == xferID) | 195 | if (XferID == xferID) |
157 | { | 196 | { |
@@ -175,11 +214,21 @@ namespace OpenSim.Framework.Communications.Cache | |||
175 | if ((packetID & 0x80000000) != 0) | 214 | if ((packetID & 0x80000000) != 0) |
176 | { | 215 | { |
177 | SendCompleteMessage(); | 216 | SendCompleteMessage(); |
217 | return true; | ||
178 | } | 218 | } |
179 | } | 219 | } |
220 | |||
221 | return false; | ||
180 | } | 222 | } |
181 | 223 | ||
182 | public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, | 224 | /// <summary> |
225 | /// Initialise asset transfer from the client | ||
226 | /// </summary> | ||
227 | /// <param name="xferID"></param> | ||
228 | /// <param name="packetID"></param> | ||
229 | /// <param name="data"></param> | ||
230 | /// <returns>True if the transfer is complete, false otherwise</returns> | ||
231 | public bool Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, | ||
183 | bool storeLocal, bool tempFile) | 232 | bool storeLocal, bool tempFile) |
184 | { | 233 | { |
185 | ourClient = remoteClient; | 234 | ourClient = remoteClient; |
@@ -198,11 +247,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
198 | if (Asset.Data.Length > 2) | 247 | if (Asset.Data.Length > 2) |
199 | { | 248 | { |
200 | SendCompleteMessage(); | 249 | SendCompleteMessage(); |
250 | return true; | ||
201 | } | 251 | } |
202 | else | 252 | else |
203 | { | 253 | { |
204 | ReqestStartXfer(); | 254 | ReqestStartXfer(); |
205 | } | 255 | } |
256 | |||
257 | return false; | ||
206 | } | 258 | } |
207 | 259 | ||
208 | protected void ReqestStartXfer() | 260 | protected void ReqestStartXfer() |