aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Agent
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 16:35:00 +0000
committerAdam Frisby2008-05-01 16:35:00 +0000
commit13526097f24b7a8ad63b1d482c44b44397fa055f (patch)
tree7a82c20ed7c63e2aea5ad3863325e37f64e1cbea /OpenSim/Region/Environment/Modules/Agent
parent* Breaking all the code, breaking all the code..! (diff)
downloadopensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.zip
opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.gz
opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.bz2
opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.xz
* Spring cleaning on Region.Environment.
* Converted a large number of read-only fields to be actually, readonly. * Reformatted code sections. * Removed redundant code.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent')
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs21
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs13
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs9
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureNotFoundSender.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs19
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs12
7 files changed, 43 insertions, 57 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs
index 48db51b..550b673 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetDownload/AssetDownloadModule.cs
@@ -40,15 +40,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
40 /// <summary> 40 /// <summary>
41 /// Asset requests with data which are ready to be sent back to requesters. This includes textures. 41 /// Asset requests with data which are ready to be sent back to requesters. This includes textures.
42 /// </summary> 42 /// </summary>
43 private List<AssetRequest> AssetRequests; 43 private readonly List<AssetRequest> AssetRequests;
44 44
45 private Scene m_scene; 45 private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
46 private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
47 46
48 /// 47 ///
49 /// Assets requests (for each user) which are waiting for asset server data. This includes texture requests 48 /// Assets requests (for each user) which are waiting for asset server data. This includes texture requests
50 /// </summary> 49 /// </summary>
51 private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets; 50 private readonly Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets;
51
52 private Scene m_scene;
52 53
53 public AssetDownloadModule() 54 public AssetDownloadModule()
54 { 55 {
@@ -205,22 +206,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
205 { 206 {
206 public AssetBase AssetInf; 207 public AssetBase AssetInf;
207 public byte AssetRequestSource = 2; 208 public byte AssetRequestSource = 2;
208 public long DataPointer = 0; 209 public long DataPointer;
209 public int DiscardLevel = -1; 210 public int DiscardLevel = -1;
210 public AssetBase ImageInfo; 211 public AssetBase ImageInfo;
211 public bool IsTextureRequest; 212 public bool IsTextureRequest;
212 public int NumPackets = 0; 213 public int NumPackets;
213 public int PacketCounter = 0; 214 public int PacketCounter;
214 public byte[] Params = null; 215 public byte[] Params;
215 public LLUUID RequestAssetID; 216 public LLUUID RequestAssetID;
216 public IClientAPI RequestUser; 217 public IClientAPI RequestUser;
217 public LLUUID TransferRequestID; 218 public LLUUID TransferRequestID;
218 //public bool AssetInCache; 219 //public bool AssetInCache;
219 //public int TimeRequested; 220 //public int TimeRequested;
220
221 public AssetRequest()
222 {
223 }
224 } 221 }
225 222
226 #endregion 223 #endregion
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 555d5f4..008daa2 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
44 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 44 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 // Fields 46 // Fields
47 private bool m_dumpAssetsToFile; 47 private readonly bool m_dumpAssetsToFile;
48 public AgentAssetTransactionsManager Manager; 48 public AgentAssetTransactionsManager Manager;
49 public LLUUID UserID; 49 public LLUUID UserID;
50 public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>(); 50 public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
@@ -141,23 +141,23 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
141 public class AssetXferUploader 141 public class AssetXferUploader
142 { 142 {
143 // Fields 143 // Fields
144 private readonly bool m_dumpAssetToFile;
145 private readonly AgentAssetTransactions m_userTransactions;
144 public bool AddToInventory; 146 public bool AddToInventory;
145 public AssetBase Asset; 147 public AssetBase Asset;
146 public LLUUID InventFolder = LLUUID.Zero; 148 public LLUUID InventFolder = LLUUID.Zero;
147 private sbyte invType = 0; 149 private sbyte invType;
148 private bool m_createItem = false; 150 private bool m_createItem;
149 private string m_description = String.Empty; 151 private string m_description = String.Empty;
150 private bool m_dumpAssetToFile; 152 private bool m_finished;
151 private bool m_finished = false;
152 private string m_name = String.Empty; 153 private string m_name = String.Empty;
153 private bool m_storeLocal; 154 private bool m_storeLocal;
154 private AgentAssetTransactions m_userTransactions; 155 private uint nextPerm;
155 private uint nextPerm = 0;
156 private IClientAPI ourClient; 156 private IClientAPI ourClient;
157 public LLUUID TransactionID = LLUUID.Zero; 157 public LLUUID TransactionID = LLUUID.Zero;
158 private sbyte type = 0; 158 private sbyte type;
159 public bool UploadComplete; 159 public bool UploadComplete;
160 private byte wearableType = 0; 160 private byte wearableType;
161 public ulong XferID; 161 public ulong XferID;
162 162
163 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) 163 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
@@ -390,7 +390,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
390 item.BasePermissions = 2147483647; 390 item.BasePermissions = 2147483647;
391 item.CurrentPermissions = 2147483647; 391 item.CurrentPermissions = 2147483647;
392 item.NextPermissions = nextPerm; 392 item.NextPermissions = nextPerm;
393 item.Flags = (uint) wearableType; 393 item.Flags = wearableType;
394 394
395 userInfo.AddItem(ourClient.AgentId, item); 395 userInfo.AddItem(ourClient.AgentId, item);
396 ourClient.SendInventoryItemCreateUpdate(item); 396 ourClient.SendInventoryItemCreateUpdate(item);
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
index fcd0e0c..d7f5804 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -40,16 +40,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
40 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions 40 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
41 { 41 {
42 private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); 42 private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
43 private bool m_dumpAssetsToFile = false; 43 private bool m_dumpAssetsToFile;
44 private Scene m_scene = null; 44 private Scene m_scene;
45 45
46 private AgentAssetTransactionsManager m_transactionManager; 46 private AgentAssetTransactionsManager m_transactionManager;
47 47
48 public AssetTransactionModule()
49 {
50 // System.Console.WriteLine("creating AgentAssetTransactionModule");
51 }
52
53 #region IAgentAssetTransactions Members 48 #region IAgentAssetTransactions Members
54 49
55 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, 50 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
@@ -145,13 +140,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
145 /// <summary> 140 /// <summary>
146 /// Each agent has its own singleton collection of transactions 141 /// Each agent has its own singleton collection of transactions
147 /// </summary> 142 /// </summary>
148 private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = 143 private readonly Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
149 new Dictionary<LLUUID, AgentAssetTransactions>(); 144 new Dictionary<LLUUID, AgentAssetTransactions>();
150 145
151 /// <summary> 146 /// <summary>
152 /// Should we dump uploaded assets to the filesystem? 147 /// Should we dump uploaded assets to the filesystem?
153 /// </summary> 148 /// </summary>
154 private bool m_dumpAssetsToFile; 149 private readonly bool m_dumpAssetsToFile;
155 150
156 public Scene MyScene; 151 public Scene MyScene;
157 152
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs
index 474ac75..96ef61f 100644
--- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs
@@ -47,6 +47,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
47 private readonly BlockingQueue<ITextureSender> m_queueSenders 47 private readonly BlockingQueue<ITextureSender> m_queueSenders
48 = new BlockingQueue<ITextureSender>(); 48 = new BlockingQueue<ITextureSender>();
49 49
50 private readonly List<Scene> m_scenes = new List<Scene>();
51
50 /// <summary> 52 /// <summary>
51 /// Each user has their own texture download service. 53 /// Each user has their own texture download service.
52 /// </summary> 54 /// </summary>
@@ -54,14 +56,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
54 new Dictionary<LLUUID, UserTextureDownloadService>(); 56 new Dictionary<LLUUID, UserTextureDownloadService>();
55 57
56 private Scene m_scene; 58 private Scene m_scene;
57 private List<Scene> m_scenes = new List<Scene>();
58 59
59 private Thread m_thread; 60 private Thread m_thread;
60 61
61 public TextureDownloadModule()
62 {
63 }
64
65 #region IRegionModule Members 62 #region IRegionModule Members
66 63
67 public void Initialise(Scene scene, IConfigSource config) 64 public void Initialise(Scene scene, IConfigSource config)
@@ -69,7 +66,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
69 if (m_scene == null) 66 if (m_scene == null)
70 { 67 {
71 //Console.WriteLine("Creating Texture download module"); 68 //Console.WriteLine("Creating Texture download module");
72 m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); 69 m_thread = new Thread(ProcessTextureSenders);
73 m_thread.Name = "ProcessTextureSenderThread"; 70 m_thread.Name = "ProcessTextureSenderThread";
74 m_thread.IsBackground = true; 71 m_thread.IsBackground = true;
75 m_thread.Start(); 72 m_thread.Start();
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureNotFoundSender.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureNotFoundSender.cs
index 70e44d4..7d4c919 100644
--- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureNotFoundSender.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureNotFoundSender.cs
@@ -40,13 +40,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
40 //private static readonly log4net.ILog m_log 40 //private static readonly log4net.ILog m_log
41 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 41 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 private bool m_cancel = false; 43 private readonly LLUUID m_textureId;
44 private bool m_cancel;
44 private IClientAPI m_client; 45 private IClientAPI m_client;
45 46
46 // See ITextureSender 47 // See ITextureSender
47 48
48 private bool m_sending = false; 49 private bool m_sending;
49 private LLUUID m_textureId;
50 50
51 // See ITextureSender 51 // See ITextureSender
52 52
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs
index 02c541b..44b9a23 100644
--- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs
@@ -43,12 +43,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
43 private static readonly ILog m_log 43 private static readonly ILog m_log
44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private readonly IClientAPI RequestUser;
47
46 /// <summary> 48 /// <summary>
47 /// Records the number of times texture send has been called. 49 /// Records the number of times texture send has been called.
48 /// </summary> 50 /// </summary>
49 public int counter = 0; 51 public int counter;
50 52
51 public bool ImageLoaded = false; 53 public bool ImageLoaded;
52 54
53 /// <summary> 55 /// <summary>
54 /// Holds the texture asset to send. 56 /// Holds the texture asset to send.
@@ -57,27 +59,26 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
57 59
58 //public LLUUID assetID { get { return m_asset.FullID; } } 60 //public LLUUID assetID { get { return m_asset.FullID; } }
59 61
60 private bool m_cancel = false; 62 private bool m_cancel;
61 63
62 // See ITextureSender 64 // See ITextureSender
63 65
64 private bool m_sending = false; 66 private bool m_sending;
65 67
66 /// <summary> 68 /// <summary>
67 /// This is actually the number of extra packets required to send the texture data! We always assume 69 /// This is actually the number of extra packets required to send the texture data! We always assume
68 /// at least one is required. 70 /// at least one is required.
69 /// </summary> 71 /// </summary>
70 private int NumPackets = 0; 72 private int NumPackets;
71 73
72 /// <summary> 74 /// <summary>
73 /// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts 75 /// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts
74 /// at the 600th byte (0th indexed). 76 /// at the 600th byte (0th indexed).
75 /// </summary> 77 /// </summary>
76 private int PacketCounter = 0; 78 private int PacketCounter;
77 79
78 private int RequestedDiscardLevel = -1; 80 private int RequestedDiscardLevel = -1;
79 private IClientAPI RequestUser; 81 private uint StartPacketNumber;
80 private uint StartPacketNumber = 0;
81 82
82 public TextureSender(IClientAPI client, int discardLevel, uint packetNumber) 83 public TextureSender(IClientAPI client, int discardLevel, uint packetNumber)
83 { 84 {
@@ -190,7 +191,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
190 catch (ArgumentOutOfRangeException) 191 catch (ArgumentOutOfRangeException)
191 { 192 {
192 m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + 193 m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" +
193 m_asset.FullID.ToString()); 194 m_asset.FullID);
194 return; 195 return;
195 } 196 }
196 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); 197 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
diff --git a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
index 8e90d17..eaf2198 100644
--- a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
@@ -41,10 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
41 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 41 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
42 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 42 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
43 43
44 public XferModule()
45 {
46 }
47
48 #region IRegionModule Members 44 #region IRegionModule Members
49 45
50 public void Initialise(Scene scene, IConfigSource config) 46 public void Initialise(Scene scene, IConfigSource config)
@@ -149,11 +145,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
149 public IClientAPI Client; 145 public IClientAPI Client;
150 private bool complete; 146 private bool complete;
151 public byte[] Data = new byte[0]; 147 public byte[] Data = new byte[0];
152 public int DataPointer = 0; 148 public int DataPointer;
153 public string FileName = String.Empty; 149 public string FileName = String.Empty;
154 public uint Packet = 0; 150 public uint Packet;
155 public uint Serial = 1; 151 public uint Serial = 1;
156 public ulong XferID = 0; 152 public ulong XferID;
157 153
158 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) 154 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
159 { 155 {
@@ -217,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
217 { 213 {
218 byte[] transferData = new byte[Data.Length - DataPointer]; 214 byte[] transferData = new byte[Data.Length - DataPointer];
219 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); 215 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
220 uint endPacket = Packet |= (uint) 0x80000000; 216 uint endPacket = Packet |= 0x80000000;
221 Client.SendXferPacket(XferID, endPacket, transferData); 217 Client.SendXferPacket(XferID, endPacket, transferData);
222 Packet++; 218 Packet++;
223 DataPointer += (Data.Length - DataPointer); 219 DataPointer += (Data.Length - DataPointer);