aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs17
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs260
-rw-r--r--OpenSim/Region/Environment/Modules/SunModule.cs37
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs42
-rw-r--r--OpenSim/Region/Environment/Modules/WorldCommModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/XMLRPCModule.cs9
7 files changed, 191 insertions, 188 deletions
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 0b95aee..c31a79b 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -27,11 +27,12 @@
27*/ 27*/
28 28
29using System; 29using System;
30using libsecondlife;
31using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
37 38
@@ -59,9 +60,9 @@ namespace OpenSim.Region.Environment.Modules
59 { 60 {
60 m_avatarsAppearance[avatarId] = appearance; 61 m_avatarsAppearance[avatarId] = appearance;
61 } 62 }
62 catch (System.NullReferenceException) 63 catch (NullReferenceException)
63 { 64 {
64 OpenSim.Framework.Console.MainLog.Instance.Error("AVATAR", "Unable to load appearance for uninitialized avatar"); 65 MainLog.Instance.Error("AVATAR", "Unable to load appearance for uninitialized avatar");
65 } 66 }
66 return true; 67 return true;
67 } 68 }
@@ -98,17 +99,17 @@ namespace OpenSim.Region.Environment.Modules
98 99
99 public void NewClient(IClientAPI client) 100 public void NewClient(IClientAPI client)
100 { 101 {
101 client.OnAvatarNowWearing += AvatarIsWearing; 102 client.OnAvatarNowWearing += AvatarIsWearing;
102 } 103 }
103 104
104 public void RemoveClient(IClientAPI client) 105 public void RemoveClient(IClientAPI client)
105 { 106 {
106 // client.OnAvatarNowWearing -= AvatarIsWearing; 107 // client.OnAvatarNowWearing -= AvatarIsWearing;
107 } 108 }
108 109
109 public void AvatarIsWearing(Object sender, AvatarWearingArgs e) 110 public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
110 { 111 {
111 IClientAPI clientView = (IClientAPI)sender; 112 IClientAPI clientView = (IClientAPI) sender;
112 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); 113 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
113 if (profile != null) 114 if (profile != null)
114 { 115 {
@@ -127,7 +128,7 @@ namespace OpenSim.Region.Environment.Modules
127 { 128 {
128 assetId = baseItem.assetID; 129 assetId = baseItem.assetID;
129 //temporary dictionary storage. This should be storing to a database 130 //temporary dictionary storage. This should be storing to a database
130 131
131 if (m_avatarsAppearance.ContainsKey(clientView.AgentId)) 132 if (m_avatarsAppearance.ContainsKey(clientView.AgentId))
132 { 133 {
133 AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId]; 134 AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId];
@@ -158,4 +159,4 @@ namespace OpenSim.Region.Environment.Modules
158 return visualParams; 159 return visualParams;
159 } 160 }
160 } 161 }
161} 162} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 069eb3f..d6df978 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -176,10 +176,10 @@ namespace OpenSim.Region.Environment.Modules
176 foreach (Scene s in m_scenes) 176 foreach (Scene s in m_scenes)
177 { 177 {
178 s.ForEachScenePresence(delegate(ScenePresence presence) 178 s.ForEachScenePresence(delegate(ScenePresence presence)
179 { 179 {
180 TrySendChatMessage(presence, fromPos, regionPos, 180 TrySendChatMessage(presence, fromPos, regionPos,
181 fromAgentID, fromName, e.Type, message); 181 fromAgentID, fromName, e.Type, message);
182 }); 182 });
183 } 183 }
184 } 184 }
185 } 185 }
@@ -373,4 +373,4 @@ namespace OpenSim.Region.Environment.Modules
373 m_tcp.Close(); 373 m_tcp.Close();
374 } 374 }
375 } 375 }
376} 376} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
index d47004b..f8798dc 100644
--- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
@@ -27,18 +27,15 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Net; 32using System.Net;
32using System.Text; 33using System.Text;
33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes;
35using System.Collections;
36using System.Collections.Generic;
37using System.Threading; 34using System.Threading;
38using libsecondlife; 35using libsecondlife;
39using Nini.Config; 36using Nini.Config;
40using Nwc.XmlRpc; 37using OpenSim.Region.Environment.Interfaces;
41using OpenSim.Framework.Servers; 38using OpenSim.Region.Environment.Scenes;
42 39
43/***************************************************** 40/*****************************************************
44 * 41 *
@@ -85,120 +82,120 @@ using OpenSim.Framework.Servers;
85 82
86namespace OpenSim.Region.Environment.Modules 83namespace OpenSim.Region.Environment.Modules
87{ 84{
88 public class ScriptHTTPRequests : IRegionModule, IHttpRequests 85 public class ScriptHTTPRequests : IRegionModule, IHttpRequests
89 { 86 {
90 private Scene m_scene; 87 private Scene m_scene;
91 private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); 88 private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
92 private object HttpListLock = new object(); 89 private object HttpListLock = new object();
93 private string m_name = "HttpScriptRequests"; 90 private string m_name = "HttpScriptRequests";
94 private int httpTimeout = 300; 91 private int httpTimeout = 300;
95 92
96 // <request id, HttpRequestClass> 93 // <request id, HttpRequestClass>
97 private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests; 94 private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests;
98 95
99 public ScriptHTTPRequests() 96 public ScriptHTTPRequests()
100 { 97 {
101 } 98 }
102 99
103 public void Initialise(Scene scene, IConfigSource config) 100 public void Initialise(Scene scene, IConfigSource config)
104 { 101 {
105 m_scene = scene; 102 m_scene = scene;
106 103
107 m_scene.RegisterModuleInterface<IHttpRequests>(this); 104 m_scene.RegisterModuleInterface<IHttpRequests>(this);
108 105
109 m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>(); 106 m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>();
110 } 107 }
111 108
112 public void PostInitialise() 109 public void PostInitialise()
113 { 110 {
114 } 111 }
115 112
116 public void Close() 113 public void Close()
117 { 114 {
118 } 115 }
119 116
120 public string Name 117 public string Name
121 { 118 {
122 get { return m_name; } 119 get { return m_name; }
123 } 120 }
124 121
125 public bool IsSharedModule 122 public bool IsSharedModule
126 { 123 {
127 get { return true; } 124 get { return true; }
128 } 125 }
129 126
130 public LLUUID MakeHttpRequest(string url, string parameters, string body) { 127 public LLUUID MakeHttpRequest(string url, string parameters, string body)
131 return LLUUID.Zero; 128 {
132 } 129 return LLUUID.Zero;
133 130 }
134 public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) 131
135 { 132 public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
136 LLUUID reqID = LLUUID.Random(); 133 {
137 HttpRequestClass htc = new HttpRequestClass(); 134 LLUUID reqID = LLUUID.Random();
138 135 HttpRequestClass htc = new HttpRequestClass();
139 // Parameters are expected in {key, value, ... , key, value} 136
140 if( parameters != null ) 137 // Parameters are expected in {key, value, ... , key, value}
141 { 138 if (parameters != null)
142 string[] parms = parameters.ToArray(); 139 {
143 for (int i = 0; i < parms.Length / 2; i += 2) 140 string[] parms = parameters.ToArray();
141 for (int i = 0; i < parms.Length/2; i += 2)
144 { 142 {
145 switch( Int32.Parse(parms[i]) ) 143 switch (Int32.Parse(parms[i]))
146 { 144 {
147 case HttpRequestClass.HTTP_METHOD: 145 case HttpRequestClass.HTTP_METHOD:
148 146
149 htc.httpMethod = parms[i + 1]; 147 htc.httpMethod = parms[i + 1];
150 break; 148 break;
151 149
152 case HttpRequestClass.HTTP_MIMETYPE: 150 case HttpRequestClass.HTTP_MIMETYPE:
153 151
154 htc.httpMIMEType = parms[i + 1]; 152 htc.httpMIMEType = parms[i + 1];
155 break; 153 break;
156 154
157 case HttpRequestClass.HTTP_BODY_MAXLENGTH: 155 case HttpRequestClass.HTTP_BODY_MAXLENGTH:
158 156
159 // TODO implement me 157 // TODO implement me
160 break; 158 break;
161 159
162 case HttpRequestClass.HTTP_VERIFY_CERT: 160 case HttpRequestClass.HTTP_VERIFY_CERT:
163 161
164 // TODO implement me 162 // TODO implement me
165 break; 163 break;
166 } 164 }
167 } 165 }
168 } 166 }
169 167
170 htc.localID = localID; 168 htc.localID = localID;
171 htc.itemID = itemID; 169 htc.itemID = itemID;
172 htc.url = url; 170 htc.url = url;
173 htc.reqID = reqID; 171 htc.reqID = reqID;
174 htc.httpTimeout = httpTimeout; 172 htc.httpTimeout = httpTimeout;
175 htc.outbound_body = body; 173 htc.outbound_body = body;
176 174
177 lock (HttpListLock) 175 lock (HttpListLock)
178 { 176 {
179 m_pendingRequests.Add(reqID, htc); 177 m_pendingRequests.Add(reqID, htc);
180 } 178 }
181 179
182 htc.process(); 180 htc.process();
183 181
184 return reqID; 182 return reqID;
185 } 183 }
186 184
187 public void StopHttpRequest(uint m_localID, LLUUID m_itemID) 185 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
188 { 186 {
189 lock (HttpListLock) 187 lock (HttpListLock)
190 { 188 {
191 189 HttpRequestClass tmpReq;
192 HttpRequestClass tmpReq; 190 if (m_pendingRequests.TryGetValue(m_itemID, out tmpReq))
193 if (m_pendingRequests.TryGetValue(m_itemID, out tmpReq)) 191 {
194 { 192 tmpReq.Stop();
195 tmpReq.Stop(); 193 m_pendingRequests.Remove(m_itemID);
196 m_pendingRequests.Remove(m_itemID); 194 }
197 } 195 }
198 } 196 }
199 } 197
200 198 /*
201 /*
202 * TODO 199 * TODO
203 * Not sure how important ordering is is here - the next first 200 * Not sure how important ordering is is here - the next first
204 * one completed in the list is returned, based soley on its list 201 * one completed in the list is returned, based soley on its list
@@ -206,10 +203,11 @@ namespace OpenSim.Region.Environment.Modules
206 * finsihed. I thought about setting up a queue for this, but 203 * finsihed. I thought about setting up a queue for this, but
207 * it will need some refactoring and this works 'enough' right now 204 * it will need some refactoring and this works 'enough' right now
208 */ 205 */
209 public HttpRequestClass GetNextCompletedRequest() 206
210 { 207 public HttpRequestClass GetNextCompletedRequest()
211 lock (HttpListLock) 208 {
212 { 209 lock (HttpListLock)
210 {
213 foreach (LLUUID luid in m_pendingRequests.Keys) 211 foreach (LLUUID luid in m_pendingRequests.Keys)
214 { 212 {
215 HttpRequestClass tmpReq; 213 HttpRequestClass tmpReq;
@@ -225,18 +223,16 @@ namespace OpenSim.Region.Environment.Modules
225 } 223 }
226 } 224 }
227 return null; 225 return null;
228 } 226 }
229 227 }
230
231 }
232 228
233 // 229 //
234 // HTTP REAQUEST 230 // HTTP REAQUEST
235 // This class was originally in LSLLongCmdHandler 231 // This class was originally in LSLLongCmdHandler
236 // 232 //
237 // TODO: setter/getter methods, maybe pass some in 233 // TODO: setter/getter methods, maybe pass some in
238 // constructor 234 // constructor
239 // 235 //
240 236
241 public class HttpRequestClass 237 public class HttpRequestClass
242 { 238 {
@@ -280,9 +276,9 @@ namespace OpenSim.Region.Environment.Modules
280 * TODO: More work on the response codes. Right now 276 * TODO: More work on the response codes. Right now
281 * returning 200 for success or 499 for exception 277 * returning 200 for success or 499 for exception
282 */ 278 */
279
283 public void SendRequest() 280 public void SendRequest()
284 { 281 {
285
286 HttpWebResponse response = null; 282 HttpWebResponse response = null;
287 StringBuilder sb = new StringBuilder(); 283 StringBuilder sb = new StringBuilder();
288 byte[] buf = new byte[8192]; 284 byte[] buf = new byte[8192];
@@ -292,14 +288,14 @@ namespace OpenSim.Region.Environment.Modules
292 try 288 try
293 { 289 {
294 request = (HttpWebRequest) 290 request = (HttpWebRequest)
295 WebRequest.Create(url); 291 WebRequest.Create(url);
296 request.Method = httpMethod; 292 request.Method = httpMethod;
297 request.ContentType = httpMIMEType; 293 request.ContentType = httpMIMEType;
298 294
299 request.Timeout = httpTimeout; 295 request.Timeout = httpTimeout;
300 // execute the request 296 // execute the request
301 response = (HttpWebResponse) 297 response = (HttpWebResponse)
302 request.GetResponse(); 298 request.GetResponse();
303 299
304 Stream resStream = response.GetResponseStream(); 300 Stream resStream = response.GetResponseStream();
305 301
@@ -317,11 +313,9 @@ namespace OpenSim.Region.Environment.Modules
317 // continue building the string 313 // continue building the string
318 sb.Append(tempString); 314 sb.Append(tempString);
319 } 315 }
320 } 316 } while (count > 0); // any more data to read?
321 while (count > 0); // any more data to read?
322 317
323 response_body = sb.ToString(); 318 response_body = sb.ToString();
324
325 } 319 }
326 catch (Exception e) 320 catch (Exception e)
327 { 321 {
@@ -333,7 +327,6 @@ namespace OpenSim.Region.Environment.Modules
333 327
334 status = 200; 328 status = 200;
335 finished = true; 329 finished = true;
336
337 } 330 }
338 331
339 public void Stop() 332 public void Stop()
@@ -342,8 +335,9 @@ namespace OpenSim.Region.Environment.Modules
342 { 335 {
343 httpThread.Abort(); 336 httpThread.Abort();
344 } 337 }
345 catch (Exception) { } 338 catch (Exception)
339 {
340 }
346 } 341 }
347 } 342 }
348 343} \ No newline at end of file
349 } \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/SunModule.cs b/OpenSim/Region/Environment/Modules/SunModule.cs
index 233c83c..bd6cd63 100644
--- a/OpenSim/Region/Environment/Modules/SunModule.cs
+++ b/OpenSim/Region/Environment/Modules/SunModule.cs
@@ -28,13 +28,12 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife;
31using Nini.Config; 32using Nini.Config;
32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
36using libsecondlife; 35using OpenSim.Region.Environment.Interfaces;
37 36using OpenSim.Region.Environment.Scenes;
38 37
39namespace OpenSim.Region.Environment.Modules 38namespace OpenSim.Region.Environment.Modules
40{ 39{
@@ -55,17 +54,20 @@ namespace OpenSim.Region.Environment.Modules
55 { 54 {
56 m_start = DateTime.Now.Ticks; 55 m_start = DateTime.Now.Ticks;
57 m_frame = 0; 56 m_frame = 0;
58 57
59 // Just in case they don't have the stanzas 58 // Just in case they don't have the stanzas
60 try { 59 try
60 {
61 m_day_length = config.Configs["Sun"].GetDouble("day_length", m_real_day); 61 m_day_length = config.Configs["Sun"].GetDouble("day_length", m_real_day);
62 m_frame_mod = config.Configs["Sun"].GetInt("frame_rate", m_default_frame); 62 m_frame_mod = config.Configs["Sun"].GetInt("frame_rate", m_default_frame);
63 } catch (Exception) { 63 }
64 catch (Exception)
65 {
64 m_day_length = m_real_day; 66 m_day_length = m_real_day;
65 m_frame_mod = m_default_frame; 67 m_frame_mod = m_default_frame;
66 } 68 }
67 69
68 m_dilation = (int)(m_real_day / m_day_length); 70 m_dilation = (int) (m_real_day/m_day_length);
69 m_scene = scene; 71 m_scene = scene;
70 m_log = MainLog.Instance; 72 m_log = MainLog.Instance;
71 scene.EventManager.OnFrame += SunUpdate; 73 scene.EventManager.OnFrame += SunUpdate;
@@ -94,10 +96,11 @@ namespace OpenSim.Region.Environment.Modules
94 { 96 {
95 client.SendSunPos(SunPos(HourOfTheDay()), new LLVector3(0, 0.0f, 10.0f)); 97 client.SendSunPos(SunPos(HourOfTheDay()), new LLVector3(0, 0.0f, 10.0f));
96 } 98 }
97 99
98 public void SunUpdate() 100 public void SunUpdate()
99 { 101 {
100 if (m_frame < m_frame_mod) { 102 if (m_frame < m_frame_mod)
103 {
101 m_frame++; 104 m_frame++;
102 return; 105 return;
103 } 106 }
@@ -115,20 +118,20 @@ namespace OpenSim.Region.Environment.Modules
115 // time when the simulator starts, then run time forward 118 // time when the simulator starts, then run time forward
116 // faster based on time dilation factor. This means that 119 // faster based on time dilation factor. This means that
117 // ticks don't get out of hand 120 // ticks don't get out of hand
118 private double HourOfTheDay() 121 private double HourOfTheDay()
119 { 122 {
120 long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation; 123 long m_addticks = (DateTime.Now.Ticks - m_start)*m_dilation;
121 DateTime dt = new DateTime(m_start + m_addticks); 124 DateTime dt = new DateTime(m_start + m_addticks);
122 return (double)dt.Hour + ((double)dt.Minute / 60.0); 125 return (double) dt.Hour + ((double) dt.Minute/60.0);
123 } 126 }
124 127
125 private LLVector3 SunPos(double hour) 128 private LLVector3 SunPos(double hour)
126 { 129 {
127 // now we have our radian position 130 // now we have our radian position
128 double rad = (hour / m_real_day) * 2 * Math.PI - (Math.PI / 2.0); 131 double rad = (hour/m_real_day)*2*Math.PI - (Math.PI/2.0);
129 double z = Math.Sin(rad); 132 double z = Math.Sin(rad);
130 double x = Math.Cos(rad); 133 double x = Math.Cos(rad);
131 return new LLVector3((float)x, 0f, (float)z); 134 return new LLVector3((float) x, 0f, (float) z);
132 } 135 }
133 136
134 // TODO: clear this out. This is here so that I remember to 137 // TODO: clear this out. This is here so that I remember to
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 0adace1..813be8d 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -32,6 +32,7 @@ using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
37 38
@@ -48,7 +49,8 @@ namespace OpenSim.Region.Environment.Modules
48 49
49 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); 50 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>();
50 51
51 private Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices = new Dictionary<LLUUID, UserTextureDownloadService>(); 52 private Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices =
53 new Dictionary<LLUUID, UserTextureDownloadService>();
52 54
53 private Thread m_thread; 55 private Thread m_thread;
54 56
@@ -72,7 +74,6 @@ namespace OpenSim.Region.Environment.Modules
72 m_scene = scene; 74 m_scene = scene;
73 m_scene.EventManager.OnNewClient += NewClient; 75 m_scene.EventManager.OnNewClient += NewClient;
74 } 76 }
75
76 } 77 }
77 78
78 public void PostInitialise() 79 public void PostInitialise()
@@ -115,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules
115 116
116 public void TextureRequest(Object sender, TextureRequestArgs e) 117 public void TextureRequest(Object sender, TextureRequestArgs e)
117 { 118 {
118 IClientAPI client = (IClientAPI)sender; 119 IClientAPI client = (IClientAPI) sender;
119 UserTextureDownloadService textureService; 120 UserTextureDownloadService textureService;
120 if (TryGetUserTextureService(client.AgentId, out textureService)) 121 if (TryGetUserTextureService(client.AgentId, out textureService))
121 { 122 {
@@ -175,7 +176,8 @@ namespace OpenSim.Region.Environment.Modules
175 { 176 {
176 if (!m_textureSenders.ContainsKey(e.RequestedAssetID)) 177 if (!m_textureSenders.ContainsKey(e.RequestedAssetID))
177 { 178 {
178 TextureSender requestHandler = new TextureSender(client, e.RequestedAssetID, e.DiscardLevel, e.PacketNumber); 179 TextureSender requestHandler =
180 new TextureSender(client, e.RequestedAssetID, e.DiscardLevel, e.PacketNumber);
179 m_textureSenders.Add(e.RequestedAssetID, requestHandler); 181 m_textureSenders.Add(e.RequestedAssetID, requestHandler);
180 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback); 182 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback);
181 } 183 }
@@ -183,7 +185,8 @@ namespace OpenSim.Region.Environment.Modules
183 { 185 {
184 m_textureSenders[e.RequestedAssetID].UpdateRequest(e.DiscardLevel, e.PacketNumber); 186 m_textureSenders[e.RequestedAssetID].UpdateRequest(e.DiscardLevel, e.PacketNumber);
185 m_textureSenders[e.RequestedAssetID].counter = 0; 187 m_textureSenders[e.RequestedAssetID].counter = 0;
186 if ((m_textureSenders[e.RequestedAssetID].ImageLoaded) && (m_textureSenders[e.RequestedAssetID].Sending ==false)) 188 if ((m_textureSenders[e.RequestedAssetID].ImageLoaded) &&
189 (m_textureSenders[e.RequestedAssetID].Sending == false))
187 { 190 {
188 m_textureSenders[e.RequestedAssetID].Sending = true; 191 m_textureSenders[e.RequestedAssetID].Sending = true;
189 m_sharedSendersQueue.Enqueue(m_textureSenders[e.RequestedAssetID]); 192 m_sharedSendersQueue.Enqueue(m_textureSenders[e.RequestedAssetID]);
@@ -256,7 +259,7 @@ namespace OpenSim.Region.Environment.Modules
256 { 259 {
257 m_asset = asset; 260 m_asset = asset;
258 NumPackets = CalculateNumPackets(asset.Data.Length); 261 NumPackets = CalculateNumPackets(asset.Data.Length);
259 PacketCounter = (int)StartPacketNumber; 262 PacketCounter = (int) StartPacketNumber;
260 ImageLoaded = true; 263 ImageLoaded = true;
261 } 264 }
262 265
@@ -264,14 +267,15 @@ namespace OpenSim.Region.Environment.Modules
264 { 267 {
265 RequestedDiscardLevel = discardLevel; 268 RequestedDiscardLevel = discardLevel;
266 StartPacketNumber = packetNumber; 269 StartPacketNumber = packetNumber;
267 PacketCounter = (int)StartPacketNumber; 270 PacketCounter = (int) StartPacketNumber;
268 } 271 }
269 272
270 public bool SendTexturePacket() 273 public bool SendTexturePacket()
271 { 274 {
272 SendPacket(); 275 SendPacket();
273 counter++; 276 counter++;
274 if ((NumPackets == 0) || (RequestedDiscardLevel == -1) || (PacketCounter > NumPackets) || ((RequestedDiscardLevel > 0) && (counter > 50 + (NumPackets / (RequestedDiscardLevel + 1)))) ) 277 if ((NumPackets == 0) || (RequestedDiscardLevel == -1) || (PacketCounter > NumPackets) ||
278 ((RequestedDiscardLevel > 0) && (counter > 50 + (NumPackets/(RequestedDiscardLevel + 1)))))
275 { 279 {
276 return true; 280 return true;
277 } 281 }
@@ -290,7 +294,7 @@ namespace OpenSim.Region.Environment.Modules
290 im.Header.Reliable = false; 294 im.Header.Reliable = false;
291 im.ImageID.Packets = 1; 295 im.ImageID.Packets = 1;
292 im.ImageID.ID = m_asset.FullID; 296 im.ImageID.ID = m_asset.FullID;
293 im.ImageID.Size = (uint)m_asset.Data.Length; 297 im.ImageID.Size = (uint) m_asset.Data.Length;
294 im.ImageData.Data = m_asset.Data; 298 im.ImageData.Data = m_asset.Data;
295 im.ImageID.Codec = 2; 299 im.ImageID.Codec = 2;
296 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); 300 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
@@ -300,9 +304,9 @@ namespace OpenSim.Region.Environment.Modules
300 { 304 {
301 ImageDataPacket im = new ImageDataPacket(); 305 ImageDataPacket im = new ImageDataPacket();
302 im.Header.Reliable = false; 306 im.Header.Reliable = false;
303 im.ImageID.Packets = (ushort)(NumPackets); 307 im.ImageID.Packets = (ushort) (NumPackets);
304 im.ImageID.ID = m_asset.FullID; 308 im.ImageID.ID = m_asset.FullID;
305 im.ImageID.Size = (uint)m_asset.Data.Length; 309 im.ImageID.Size = (uint) m_asset.Data.Length;
306 im.ImageData.Data = new byte[600]; 310 im.ImageData.Data = new byte[600];
307 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); 311 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600);
308 im.ImageID.Codec = 2; 312 im.ImageID.Codec = 2;
@@ -314,18 +318,20 @@ namespace OpenSim.Region.Environment.Modules
314 { 318 {
315 ImagePacketPacket im = new ImagePacketPacket(); 319 ImagePacketPacket im = new ImagePacketPacket();
316 im.Header.Reliable = false; 320 im.Header.Reliable = false;
317 im.ImageID.Packet = (ushort)(PacketCounter); 321 im.ImageID.Packet = (ushort) (PacketCounter);
318 im.ImageID.ID = m_asset.FullID; 322 im.ImageID.ID = m_asset.FullID;
319 int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); 323 int size = m_asset.Data.Length - 600 - (1000*(PacketCounter - 1));
320 if (size > 1000) size = 1000; 324 if (size > 1000) size = 1000;
321 im.ImageData.Data = new byte[size]; 325 im.ImageData.Data = new byte[size];
322 try 326 try
323 { 327 {
324 Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); 328 Array.Copy(m_asset.Data, 600 + (1000*(PacketCounter - 1)), im.ImageData.Data, 0, size);
325 } 329 }
326 catch (System.ArgumentOutOfRangeException) 330 catch (ArgumentOutOfRangeException)
327 { 331 {
328 OpenSim.Framework.Console.MainLog.Instance.Warn("TEXTURE", "Unable to separate texture into multiple packets: Array bounds failure on asset:" + m_asset.FullID.ToString() + "- TextureDownloadModule.cs. line:328"); 332 MainLog.Instance.Warn("TEXTURE",
333 "Unable to separate texture into multiple packets: Array bounds failure on asset:" +
334 m_asset.FullID.ToString() + "- TextureDownloadModule.cs. line:328");
329 return; 335 return;
330 } 336 }
331 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); 337 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
@@ -342,14 +348,12 @@ namespace OpenSim.Region.Environment.Modules
342 { 348 {
343 //over 600 bytes so split up file 349 //over 600 bytes so split up file
344 int restData = (length - 600); 350 int restData = (length - 600);
345 int restPackets = ((restData + 999) / 1000); 351 int restPackets = ((restData + 999)/1000);
346 numPackets = restPackets; 352 numPackets = restPackets;
347 } 353 }
348 354
349 return numPackets; 355 return numPackets;
350 } 356 }
351 } 357 }
352
353
354 } 358 }
355} \ No newline at end of file 359} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index 0dad998..6b9ae46 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Environment.Modules
135 { 135 {
136 m_listenerManager.Remove(handle); 136 m_listenerManager.Remove(handle);
137 } 137 }
138 138
139 // This method scans nearby objects and determines if they are listeners, 139 // This method scans nearby objects and determines if they are listeners,
140 // and if so if this message fits the filter. If it does, then 140 // and if so if this message fits the filter. If it does, then
141 // enqueue the message for delivery to the objects listen event handler. 141 // enqueue the message for delivery to the objects listen event handler.
@@ -490,4 +490,4 @@ namespace OpenSim.Region.Environment.Modules
490 return m_id; 490 return m_id;
491 } 491 }
492 } 492 }
493} 493} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
index f13b2bb..481ba3f 100644
--- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
@@ -33,10 +33,10 @@ using System.Threading;
33using libsecondlife; 33using libsecondlife;
34using Nini.Config; 34using Nini.Config;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
37using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
38using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
39using OpenSim.Framework.Console;
40 40
41/***************************************************** 41/*****************************************************
42 * 42 *
@@ -116,15 +116,16 @@ namespace OpenSim.Region.Environment.Modules
116 116
117 public void PostInitialise() 117 public void PostInitialise()
118 { 118 {
119 if ( IsEnabled() ) 119 if (IsEnabled())
120 { 120 {
121 m_openChannels = new Dictionary<LLUUID, RPCChannelInfo>(); 121 m_openChannels = new Dictionary<LLUUID, RPCChannelInfo>();
122 m_pendingResponse = new Dictionary<LLUUID, RPCRequestInfo>(); 122 m_pendingResponse = new Dictionary<LLUUID, RPCRequestInfo>();
123 123
124 // Start http server 124 // Start http server
125 // Attach xmlrpc handlers 125 // Attach xmlrpc handlers
126 m_log.Verbose("REMOTE_DATA", "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); 126 m_log.Verbose("REMOTE_DATA",
127 BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort); 127 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
128 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort);
128 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 129 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
129 httpServer.Start(); 130 httpServer.Start();
130 } 131 }