diff options
Diffstat (limited to 'OpenSim')
20 files changed, 278 insertions, 673 deletions
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 80b8306..48274c1 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs | |||
@@ -26,24 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Collections.Specialized; | ||
32 | using System.Drawing; | ||
33 | using System.Drawing.Imaging; | ||
34 | using System.Reflection; | 29 | using System.Reflection; |
35 | using System.IO; | ||
36 | using System.Web; | ||
37 | using log4net; | 30 | using log4net; |
38 | using Nini.Config; | ||
39 | using OpenMetaverse; | 31 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | ||
41 | using OpenMetaverse.Imaging; | ||
42 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Capabilities; | 33 | using OpenSim.Framework.Capabilities; |
44 | using OpenSim.Framework.Servers; | ||
45 | using OpenSim.Framework.Servers.HttpServer; | 34 | using OpenSim.Framework.Servers.HttpServer; |
46 | using OpenSim.Region.Framework.Interfaces; | ||
47 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | 36 | using Caps = OpenSim.Framework.Capabilities.Caps; |
49 | 37 | ||
@@ -56,13 +44,11 @@ namespace OpenSim.Capabilities.Handlers | |||
56 | 44 | ||
57 | private Caps m_HostCapsObj; | 45 | private Caps m_HostCapsObj; |
58 | private IAssetService m_assetService; | 46 | private IAssetService m_assetService; |
59 | private bool m_persistBakedTextures; | ||
60 | 47 | ||
61 | public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures) | 48 | public UploadBakedTextureHandler(Caps caps, IAssetService assetService) |
62 | { | 49 | { |
63 | m_HostCapsObj = caps; | 50 | m_HostCapsObj = caps; |
64 | m_assetService = assetService; | 51 | m_assetService = assetService; |
65 | m_persistBakedTextures = persistBakedTextures; | ||
66 | } | 52 | } |
67 | 53 | ||
68 | /// <summary> | 54 | /// <summary> |
@@ -125,9 +111,8 @@ namespace OpenSim.Capabilities.Handlers | |||
125 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); | 111 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); |
126 | asset.Data = data; | 112 | asset.Data = data; |
127 | asset.Temporary = true; | 113 | asset.Temporary = true; |
128 | asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are | 114 | asset.Local = true; |
129 | m_assetService.Store(asset); | 115 | m_assetService.Store(asset); |
130 | |||
131 | } | 116 | } |
132 | } | 117 | } |
133 | 118 | ||
@@ -151,8 +136,6 @@ namespace OpenSim.Capabilities.Handlers | |||
151 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); | 136 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); |
152 | } | 137 | } |
153 | 138 | ||
154 | |||
155 | |||
156 | /// <summary> | 139 | /// <summary> |
157 | /// Handle raw uploaded baked texture data. | 140 | /// Handle raw uploaded baked texture data. |
158 | /// </summary> | 141 | /// </summary> |
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs index 10ea8ee..fd484ba 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Capabilities.Handlers | |||
67 | server.AddStreamHandler(new RestStreamHandler( | 67 | server.AddStreamHandler(new RestStreamHandler( |
68 | "POST", | 68 | "POST", |
69 | "/CAPS/UploadBakedTexture/", | 69 | "/CAPS/UploadBakedTexture/", |
70 | new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture, | 70 | new UploadBakedTextureHandler(caps, m_AssetService).UploadBakedTexture, |
71 | "UploadBakedTexture", | 71 | "UploadBakedTexture", |
72 | "Upload Baked Texture Capability")); | 72 | "Upload Baked Texture Capability")); |
73 | 73 | ||
diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index 0166d9d..4939cf7 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs | |||
@@ -428,22 +428,23 @@ namespace OpenSim.Framework | |||
428 | if (WebUtil.DebugLevel >= 5) | 428 | if (WebUtil.DebugLevel >= 5) |
429 | WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src); | 429 | WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src); |
430 | 430 | ||
431 | using (Stream dst = _request.GetRequestStream()) | 431 | |
432 | try | ||
432 | { | 433 | { |
433 | m_log.Debug("[REST]: GetRequestStream is ok"); | 434 | using (Stream dst = _request.GetRequestStream()) |
434 | |||
435 | byte[] buf = new byte[1024]; | ||
436 | int length = src.Read(buf, 0, 1024); | ||
437 | m_log.Debug("[REST]: First Read is ok"); | ||
438 | while (length > 0) | ||
439 | { | 435 | { |
440 | dst.Write(buf, 0, length); | 436 | // m_log.Debug("[REST]: GetRequestStream is ok"); |
441 | length = src.Read(buf, 0, 1024); | 437 | |
438 | byte[] buf = new byte[1024]; | ||
439 | int length = src.Read(buf, 0, 1024); | ||
440 | // m_log.Debug("[REST]: First Read is ok"); | ||
441 | while (length > 0) | ||
442 | { | ||
443 | dst.Write(buf, 0, length); | ||
444 | length = src.Read(buf, 0, 1024); | ||
445 | } | ||
442 | } | 446 | } |
443 | } | ||
444 | 447 | ||
445 | try | ||
446 | { | ||
447 | _response = (HttpWebResponse)_request.GetResponse(); | 448 | _response = (HttpWebResponse)_request.GetResponse(); |
448 | } | 449 | } |
449 | catch (WebException e) | 450 | catch (WebException e) |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index ffc6ad3..415c264 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -207,7 +207,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
207 | qu.Clear(); | 207 | qu.Clear(); |
208 | m_bycontext.Clear(); | 208 | m_bycontext.Clear(); |
209 | 209 | ||
210 | /* | ||
211 | try | 210 | try |
212 | { | 211 | { |
213 | foreach (PollServiceHttpRequest req in m_retryRequests) | 212 | foreach (PollServiceHttpRequest req in m_retryRequests) |
@@ -220,22 +219,21 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
220 | } | 219 | } |
221 | 220 | ||
222 | PollServiceHttpRequest wreq; | 221 | PollServiceHttpRequest wreq; |
223 | */ | 222 | |
224 | m_retryRequests.Clear(); | 223 | m_retryRequests.Clear(); |
225 | /* | 224 | |
226 | while (m_requests.Count() > 0) | 225 | while (m_requests.Count() > 0) |
227 | { | 226 | { |
228 | try | 227 | try |
229 | { | 228 | { |
230 | wreq = m_requests.Dequeue(0); | 229 | wreq = m_requests.Dequeue(0); |
231 | wreq.DoHTTPstop(m_server); | 230 | wreq.DoHTTPstop(m_server); |
232 | |||
233 | } | 231 | } |
234 | catch | 232 | catch |
235 | { | 233 | { |
236 | } | 234 | } |
237 | } | 235 | } |
238 | */ | 236 | |
239 | m_requests.Clear(); | 237 | m_requests.Clear(); |
240 | } | 238 | } |
241 | 239 | ||
@@ -245,7 +243,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
245 | { | 243 | { |
246 | while (m_running) | 244 | while (m_running) |
247 | { | 245 | { |
248 | PollServiceHttpRequest req = m_requests.Dequeue(5000); | 246 | PollServiceHttpRequest req = m_requests.Dequeue(4500); |
249 | Watchdog.UpdateThread(); | 247 | Watchdog.UpdateThread(); |
250 | if(req == null) | 248 | if(req == null) |
251 | continue; | 249 | continue; |
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index f627ae6..3bb2313 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs | |||
@@ -275,18 +275,6 @@ namespace OpenSim.Framework.Servers | |||
275 | (string module, string[] args) => Notice(GetThreadsReport())); | 275 | (string module, string[] args) => Notice(GetThreadsReport())); |
276 | 276 | ||
277 | m_console.Commands.AddCommand ( | 277 | m_console.Commands.AddCommand ( |
278 | "Debug", false, "debug comms set", | ||
279 | "debug comms set serialosdreq true|false", | ||
280 | "Set comms parameters. For debug purposes.", | ||
281 | HandleDebugCommsSet); | ||
282 | |||
283 | m_console.Commands.AddCommand ( | ||
284 | "Debug", false, "debug comms status", | ||
285 | "debug comms status", | ||
286 | "Show current debug comms parameters.", | ||
287 | HandleDebugCommsStatus); | ||
288 | |||
289 | m_console.Commands.AddCommand ( | ||
290 | "Debug", false, "debug threadpool set", | 278 | "Debug", false, "debug threadpool set", |
291 | "debug threadpool set worker|iocp min|max <n>", | 279 | "debug threadpool set worker|iocp min|max <n>", |
292 | "Set threadpool parameters. For debug purposes.", | 280 | "Set threadpool parameters. For debug purposes.", |
@@ -343,47 +331,13 @@ namespace OpenSim.Framework.Servers | |||
343 | 331 | ||
344 | public void RegisterCommonComponents(IConfigSource configSource) | 332 | public void RegisterCommonComponents(IConfigSource configSource) |
345 | { | 333 | { |
346 | IConfig networkConfig = configSource.Configs["Network"]; | 334 | // IConfig networkConfig = configSource.Configs["Network"]; |
347 | |||
348 | if (networkConfig != null) | ||
349 | { | ||
350 | WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false); | ||
351 | } | ||
352 | 335 | ||
353 | m_serverStatsCollector = new ServerStatsCollector(); | 336 | m_serverStatsCollector = new ServerStatsCollector(); |
354 | m_serverStatsCollector.Initialise(configSource); | 337 | m_serverStatsCollector.Initialise(configSource); |
355 | m_serverStatsCollector.Start(); | 338 | m_serverStatsCollector.Start(); |
356 | } | 339 | } |
357 | 340 | ||
358 | private void HandleDebugCommsStatus(string module, string[] args) | ||
359 | { | ||
360 | Notice("serialosdreq is {0}", WebUtil.SerializeOSDRequestsPerEndpoint); | ||
361 | } | ||
362 | |||
363 | private void HandleDebugCommsSet(string module, string[] args) | ||
364 | { | ||
365 | if (args.Length != 5) | ||
366 | { | ||
367 | Notice("Usage: debug comms set serialosdreq true|false"); | ||
368 | return; | ||
369 | } | ||
370 | |||
371 | if (args[3] != "serialosdreq") | ||
372 | { | ||
373 | Notice("Usage: debug comms set serialosdreq true|false"); | ||
374 | return; | ||
375 | } | ||
376 | |||
377 | bool setSerializeOsdRequests; | ||
378 | |||
379 | if (!ConsoleUtil.TryParseConsoleBool(m_console, args[4], out setSerializeOsdRequests)) | ||
380 | return; | ||
381 | |||
382 | WebUtil.SerializeOSDRequestsPerEndpoint = setSerializeOsdRequests; | ||
383 | |||
384 | Notice("serialosdreq is now {0}", setSerializeOsdRequests); | ||
385 | } | ||
386 | |||
387 | private void HandleShowThreadpoolCallsActive(string module, string[] args) | 341 | private void HandleShowThreadpoolCallsActive(string module, string[] args) |
388 | { | 342 | { |
389 | List<KeyValuePair<string, int>> calls = Util.GetFireAndForgetCallsInProgress().ToList(); | 343 | List<KeyValuePair<string, int>> calls = Util.GetFireAndForgetCallsInProgress().ToList(); |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 83d9df1..f52a84c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -429,64 +429,6 @@ namespace OpenSim.Framework | |||
429 | return regionCoord << 8; | 429 | return regionCoord << 8; |
430 | } | 430 | } |
431 | 431 | ||
432 | public static IPEndPoint getEndPoint(IPAddress ia, int port) | ||
433 | { | ||
434 | if(ia == null) | ||
435 | return null; | ||
436 | |||
437 | IPEndPoint newEP = null; | ||
438 | try | ||
439 | { | ||
440 | newEP = new IPEndPoint(ia, port); | ||
441 | } | ||
442 | catch | ||
443 | { | ||
444 | newEP = null; | ||
445 | } | ||
446 | return newEP; | ||
447 | } | ||
448 | |||
449 | public static IPEndPoint getEndPoint(string hostname, int port) | ||
450 | { | ||
451 | IPAddress ia = null; | ||
452 | // If it is already an IP, don't resolve it - just return directly | ||
453 | // we should not need this | ||
454 | if (IPAddress.TryParse(hostname, out ia)) | ||
455 | { | ||
456 | if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) | ||
457 | return null; | ||
458 | return getEndPoint(ia, port); | ||
459 | } | ||
460 | |||
461 | // Reset for next check | ||
462 | ia = null; | ||
463 | try | ||
464 | { | ||
465 | foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) | ||
466 | { | ||
467 | if (ia == null) | ||
468 | ia = Adr; | ||
469 | |||
470 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
471 | { | ||
472 | ia = Adr; | ||
473 | break; | ||
474 | } | ||
475 | } | ||
476 | } | ||
477 | catch // (SocketException e) | ||
478 | { | ||
479 | /*throw new Exception( | ||
480 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
481 | e + "' attached to this exception", e);*/ | ||
482 | // Don't throw a fatal exception here, instead, return Null and handle it in the caller. | ||
483 | // Reason is, on systems such as OSgrid it has occured that known hostnames stop | ||
484 | // resolving and thus make surrounding regions crash out with this exception. | ||
485 | return null; | ||
486 | } | ||
487 | |||
488 | return getEndPoint(ia,port); | ||
489 | } | ||
490 | 432 | ||
491 | public static bool checkServiceURI(string uristr, out string serviceURI) | 433 | public static bool checkServiceURI(string uristr, out string serviceURI) |
492 | { | 434 | { |
@@ -1049,6 +991,8 @@ namespace OpenSim.Framework | |||
1049 | return output.ToString(); | 991 | return output.ToString(); |
1050 | } | 992 | } |
1051 | 993 | ||
994 | private static ExpiringCache<string,IPAddress> dnscache = new ExpiringCache<string, IPAddress>(); | ||
995 | |||
1052 | /// <summary> | 996 | /// <summary> |
1053 | /// Converts a URL to a IPAddress | 997 | /// Converts a URL to a IPAddress |
1054 | /// </summary> | 998 | /// </summary> |
@@ -1066,38 +1010,128 @@ namespace OpenSim.Framework | |||
1066 | /// <returns>An IP address, or null</returns> | 1010 | /// <returns>An IP address, or null</returns> |
1067 | public static IPAddress GetHostFromDNS(string dnsAddress) | 1011 | public static IPAddress GetHostFromDNS(string dnsAddress) |
1068 | { | 1012 | { |
1069 | // Is it already a valid IP? No need to look it up. | 1013 | if(String.IsNullOrWhiteSpace(dnsAddress)) |
1070 | IPAddress ipa; | 1014 | return null; |
1071 | if (IPAddress.TryParse(dnsAddress, out ipa)) | ||
1072 | return ipa; | ||
1073 | 1015 | ||
1074 | IPAddress[] hosts = null; | 1016 | IPAddress ia = null; |
1017 | if(dnscache.TryGetValue(dnsAddress, out ia) && ia != null) | ||
1018 | { | ||
1019 | dnscache.AddOrUpdate(dnsAddress, ia, 300); | ||
1020 | return ia; | ||
1021 | } | ||
1022 | |||
1023 | ia = null; | ||
1024 | // If it is already an IP, don't let GetHostEntry see it | ||
1025 | if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) | ||
1026 | { | ||
1027 | if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) | ||
1028 | return null; | ||
1029 | dnscache.AddOrUpdate(dnsAddress, ia, 300); | ||
1030 | return ia; | ||
1031 | } | ||
1075 | 1032 | ||
1076 | // Not an IP, lookup required | 1033 | IPHostEntry IPH; |
1077 | try | 1034 | try |
1078 | { | 1035 | { |
1079 | hosts = Dns.GetHostEntry(dnsAddress).AddressList; | 1036 | IPH = Dns.GetHostEntry(dnsAddress); |
1080 | } | 1037 | } |
1081 | catch (Exception e) | 1038 | catch // (SocketException e) |
1082 | { | 1039 | { |
1083 | m_log.WarnFormat("[UTIL]: An error occurred while resolving host name {0}, {1}", dnsAddress, e); | 1040 | return null; |
1041 | } | ||
1042 | |||
1043 | if(IPH == null || IPH.AddressList.Length == 0) | ||
1044 | return null; | ||
1084 | 1045 | ||
1085 | // Still going to throw the exception on for now, since this was what was happening in the first place | 1046 | ia = null; |
1086 | throw e; | 1047 | foreach (IPAddress Adr in IPH.AddressList) |
1048 | { | ||
1049 | if (ia == null) | ||
1050 | ia = Adr; | ||
1051 | |||
1052 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
1053 | { | ||
1054 | ia = Adr; | ||
1055 | break; | ||
1056 | } | ||
1057 | } | ||
1058 | if(ia != null) | ||
1059 | dnscache.AddOrUpdate(dnsAddress, ia, 300); | ||
1060 | return ia; | ||
1061 | } | ||
1062 | |||
1063 | public static IPEndPoint getEndPoint(IPAddress ia, int port) | ||
1064 | { | ||
1065 | if(ia == null) | ||
1066 | return null; | ||
1067 | |||
1068 | IPEndPoint newEP = null; | ||
1069 | try | ||
1070 | { | ||
1071 | newEP = new IPEndPoint(ia, port); | ||
1072 | } | ||
1073 | catch | ||
1074 | { | ||
1075 | newEP = null; | ||
1076 | } | ||
1077 | return newEP; | ||
1078 | } | ||
1079 | |||
1080 | public static IPEndPoint getEndPoint(string hostname, int port) | ||
1081 | { | ||
1082 | if(String.IsNullOrWhiteSpace(hostname)) | ||
1083 | return null; | ||
1084 | |||
1085 | IPAddress ia = null; | ||
1086 | if(dnscache.TryGetValue(hostname, out ia) && ia != null) | ||
1087 | { | ||
1088 | dnscache.AddOrUpdate(hostname, ia, 300); | ||
1089 | return getEndPoint(ia, port); | ||
1087 | } | 1090 | } |
1088 | 1091 | ||
1089 | foreach (IPAddress host in hosts) | 1092 | ia = null; |
1093 | |||
1094 | // If it is already an IP, don't let GetHostEntry see it | ||
1095 | if (IPAddress.TryParse(hostname, out ia) && ia != null) | ||
1090 | { | 1096 | { |
1091 | if (host.AddressFamily == AddressFamily.InterNetwork) | 1097 | if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) |
1098 | return null; | ||
1099 | |||
1100 | dnscache.AddOrUpdate(hostname, ia, 300); | ||
1101 | return getEndPoint(ia, port); | ||
1102 | } | ||
1103 | |||
1104 | |||
1105 | IPHostEntry IPH; | ||
1106 | try | ||
1107 | { | ||
1108 | IPH = Dns.GetHostEntry(hostname); | ||
1109 | } | ||
1110 | catch // (SocketException e) | ||
1111 | { | ||
1112 | return null; | ||
1113 | } | ||
1114 | |||
1115 | if(IPH == null || IPH.AddressList.Length == 0) | ||
1116 | return null; | ||
1117 | |||
1118 | ia = null; | ||
1119 | foreach (IPAddress Adr in IPH.AddressList) | ||
1120 | { | ||
1121 | if (ia == null) | ||
1122 | ia = Adr; | ||
1123 | |||
1124 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
1092 | { | 1125 | { |
1093 | return host; | 1126 | ia = Adr; |
1127 | break; | ||
1094 | } | 1128 | } |
1095 | } | 1129 | } |
1096 | 1130 | ||
1097 | if (hosts.Length > 0) | 1131 | if(ia != null) |
1098 | return hosts[0]; | 1132 | dnscache.AddOrUpdate(hostname, ia, 300); |
1099 | 1133 | ||
1100 | return null; | 1134 | return getEndPoint(ia,port); |
1101 | } | 1135 | } |
1102 | 1136 | ||
1103 | public static Uri GetURI(string protocol, string hostname, int port, string path) | 1137 | public static Uri GetURI(string protocol, string hostname, int port, string path) |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 12f58fe..7b085d0 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -72,11 +72,6 @@ namespace OpenSim.Framework | |||
72 | public static int RequestNumber { get; set; } | 72 | public static int RequestNumber { get; set; } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Control where OSD requests should be serialized per endpoint. | ||
76 | /// </summary> | ||
77 | public static bool SerializeOSDRequestsPerEndpoint { get; set; } | ||
78 | |||
79 | /// <summary> | ||
80 | /// this is the header field used to communicate the local request id | 75 | /// this is the header field used to communicate the local request id |
81 | /// used for performance and debugging | 76 | /// used for performance and debugging |
82 | /// </summary> | 77 | /// </summary> |
@@ -98,31 +93,6 @@ namespace OpenSim.Framework | |||
98 | /// </remarks> | 93 | /// </remarks> |
99 | public const int MaxRequestDiagLength = 200; | 94 | public const int MaxRequestDiagLength = 200; |
100 | 95 | ||
101 | /// <summary> | ||
102 | /// Dictionary of end points | ||
103 | /// </summary> | ||
104 | private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>(); | ||
105 | |||
106 | private static object EndPointLock(string url) | ||
107 | { | ||
108 | System.Uri uri = new System.Uri(url); | ||
109 | string endpoint = string.Format("{0}:{1}",uri.Host,uri.Port); | ||
110 | |||
111 | lock (m_endpointSerializer) | ||
112 | { | ||
113 | object eplock = null; | ||
114 | |||
115 | if (! m_endpointSerializer.TryGetValue(endpoint,out eplock)) | ||
116 | { | ||
117 | eplock = new object(); | ||
118 | m_endpointSerializer.Add(endpoint,eplock); | ||
119 | // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint); | ||
120 | } | ||
121 | |||
122 | return eplock; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | #region JSONRequest | 96 | #region JSONRequest |
127 | 97 | ||
128 | /// <summary> | 98 | /// <summary> |
@@ -154,21 +124,6 @@ namespace OpenSim.Framework | |||
154 | return ServiceOSDRequest(url, null, "GET", timeout, false, false); | 124 | return ServiceOSDRequest(url, null, "GET", timeout, false, false); |
155 | } | 125 | } |
156 | 126 | ||
157 | public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) | ||
158 | { | ||
159 | if (SerializeOSDRequestsPerEndpoint) | ||
160 | { | ||
161 | lock (EndPointLock(url)) | ||
162 | { | ||
163 | return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); | ||
164 | } | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | public static void LogOutgoingDetail(Stream outputStream) | 127 | public static void LogOutgoingDetail(Stream outputStream) |
173 | { | 128 | { |
174 | LogOutgoingDetail("", outputStream); | 129 | LogOutgoingDetail("", outputStream); |
@@ -222,7 +177,7 @@ namespace OpenSim.Framework | |||
222 | LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input); | 177 | LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input); |
223 | } | 178 | } |
224 | 179 | ||
225 | private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) | 180 | public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) |
226 | { | 181 | { |
227 | int reqnum = RequestNumber++; | 182 | int reqnum = RequestNumber++; |
228 | 183 | ||
@@ -422,14 +377,6 @@ namespace OpenSim.Framework | |||
422 | 377 | ||
423 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) | 378 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) |
424 | { | 379 | { |
425 | lock (EndPointLock(url)) | ||
426 | { | ||
427 | return ServiceFormRequestWorker(url,data,timeout); | ||
428 | } | ||
429 | } | ||
430 | |||
431 | private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) | ||
432 | { | ||
433 | int reqnum = RequestNumber++; | 380 | int reqnum = RequestNumber++; |
434 | string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; | 381 | string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; |
435 | 382 | ||
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 447afb4..66ce8e5 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -79,10 +79,9 @@ namespace OpenSim | |||
79 | else | 79 | else |
80 | { | 80 | { |
81 | ServicePointManager.DefaultConnectionLimit = 12; | 81 | ServicePointManager.DefaultConnectionLimit = 12; |
82 | try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some crazy mono decides to have it infinity | ||
83 | catch { } | ||
84 | } | 82 | } |
85 | 83 | ||
84 | try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { } | ||
86 | ServicePointManager.Expect100Continue = false; | 85 | ServicePointManager.Expect100Continue = false; |
87 | ServicePointManager.UseNagleAlgorithm = false; | 86 | ServicePointManager.UseNagleAlgorithm = false; |
88 | 87 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index dfe097e..b406b37 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -63,9 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
63 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. | 63 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. |
64 | 64 | ||
65 | private Scene m_scene; | 65 | private Scene m_scene; |
66 | private bool m_persistBakedTextures; | ||
67 | 66 | ||
68 | private IBakedTextureModule m_BakedTextureModule; | ||
69 | private string m_URL; | 67 | private string m_URL; |
70 | 68 | ||
71 | public void Initialise(IConfigSource source) | 69 | public void Initialise(IConfigSource source) |
@@ -76,15 +74,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
76 | 74 | ||
77 | m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); | 75 | m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); |
78 | 76 | ||
79 | IConfig appearanceConfig = source.Configs["Appearance"]; | 77 | // IConfig appearanceConfig = source.Configs["Appearance"]; |
80 | if (appearanceConfig != null) | ||
81 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | ||
82 | } | 78 | } |
83 | 79 | ||
84 | public void AddRegion(Scene s) | 80 | public void AddRegion(Scene s) |
85 | { | 81 | { |
86 | m_scene = s; | 82 | m_scene = s; |
87 | |||
88 | } | 83 | } |
89 | 84 | ||
90 | public void RemoveRegion(Scene s) | 85 | public void RemoveRegion(Scene s) |
@@ -92,7 +87,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
92 | s.EventManager.OnRegisterCaps -= RegisterCaps; | 87 | s.EventManager.OnRegisterCaps -= RegisterCaps; |
93 | s.EventManager.OnNewPresence -= RegisterNewPresence; | 88 | s.EventManager.OnNewPresence -= RegisterNewPresence; |
94 | s.EventManager.OnRemovePresence -= DeRegisterPresence; | 89 | s.EventManager.OnRemovePresence -= DeRegisterPresence; |
95 | m_BakedTextureModule = null; | ||
96 | m_scene = null; | 90 | m_scene = null; |
97 | } | 91 | } |
98 | 92 | ||
@@ -101,7 +95,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
101 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 95 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
102 | m_scene.EventManager.OnNewPresence += RegisterNewPresence; | 96 | m_scene.EventManager.OnNewPresence += RegisterNewPresence; |
103 | m_scene.EventManager.OnRemovePresence += DeRegisterPresence; | 97 | m_scene.EventManager.OnRemovePresence += DeRegisterPresence; |
104 | |||
105 | } | 98 | } |
106 | 99 | ||
107 | private void DeRegisterPresence(UUID agentId) | 100 | private void DeRegisterPresence(UUID agentId) |
@@ -110,156 +103,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
110 | 103 | ||
111 | private void RegisterNewPresence(ScenePresence presence) | 104 | private void RegisterNewPresence(ScenePresence presence) |
112 | { | 105 | { |
113 | // presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; | ||
114 | } | 106 | } |
115 | 107 | ||
116 | /* not in use. work done in AvatarFactoryModule ValidateBakedTextureCache() and UpdateBakedTextureCache() | ||
117 | private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) | ||
118 | { | ||
119 | // if cacheItems.Length > 0 viewer is giving us current textures information. | ||
120 | // baked ones should had been uploaded and in assets cache as local itens | ||
121 | |||
122 | |||
123 | if (cacheItems.Length == 0) | ||
124 | return; // no textures information, nothing to do | ||
125 | |||
126 | ScenePresence p = null; | ||
127 | if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) | ||
128 | return; // what are we doing if there is no presence to cache for? | ||
129 | |||
130 | if (p.IsDeleted) | ||
131 | return; // does this really work? | ||
132 | |||
133 | int maxCacheitemsLoop = cacheItems.Length; | ||
134 | if (maxCacheitemsLoop > 20) | ||
135 | { | ||
136 | maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; | ||
137 | m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); | ||
138 | } | ||
139 | |||
140 | m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
141 | |||
142 | |||
143 | // some nice debug | ||
144 | m_log.Debug("[Cacheitems]: " + cacheItems.Length); | ||
145 | for (int iter = 0; iter < maxCacheitemsLoop; iter++) | ||
146 | { | ||
147 | m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + | ||
148 | cacheItems[iter].TextureID); | ||
149 | } | ||
150 | |||
151 | // p.Appearance.WearableCacheItems is in memory primary cashID to textures mapper | ||
152 | |||
153 | WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; | ||
154 | |||
155 | if (existingitems == null) | ||
156 | { | ||
157 | if (m_BakedTextureModule != null) | ||
158 | { | ||
159 | WearableCacheItem[] savedcache = null; | ||
160 | try | ||
161 | { | ||
162 | if (p.Appearance.WearableCacheItemsDirty) | ||
163 | { | ||
164 | savedcache = m_BakedTextureModule.Get(p.UUID); | ||
165 | p.Appearance.WearableCacheItems = savedcache; | ||
166 | p.Appearance.WearableCacheItemsDirty = false; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | catch (Exception) | ||
171 | { | ||
172 | // The service logs a sufficient error message. | ||
173 | } | ||
174 | |||
175 | |||
176 | if (savedcache != null) | ||
177 | existingitems = savedcache; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | // Existing items null means it's a fully new appearance | ||
182 | if (existingitems == null) | ||
183 | { | ||
184 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
185 | { | ||
186 | if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) | ||
187 | { | ||
188 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; | ||
189 | if (face == null) | ||
190 | { | ||
191 | textureEntry.CreateFace(cacheItems[i].TextureIndex); | ||
192 | textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = | ||
193 | AppearanceManager.DEFAULT_AVATAR_TEXTURE; | ||
194 | continue; | ||
195 | } | ||
196 | cacheItems[i].TextureID = face.TextureID; | ||
197 | if (m_scene.AssetService != null) | ||
198 | cacheItems[i].TextureAsset = | ||
199 | m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); | ||
200 | } | ||
201 | else | ||
202 | { | ||
203 | m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
210 | { | ||
211 | if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) | ||
212 | { | ||
213 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; | ||
214 | if (face == null) | ||
215 | { | ||
216 | textureEntry.CreateFace(cacheItems[i].TextureIndex); | ||
217 | textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = | ||
218 | AppearanceManager.DEFAULT_AVATAR_TEXTURE; | ||
219 | continue; | ||
220 | } | ||
221 | cacheItems[i].TextureID = | ||
222 | face.TextureID; | ||
223 | } | ||
224 | else | ||
225 | { | ||
226 | m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
231 | { | ||
232 | if (cacheItems[i].TextureAsset == null) | ||
233 | { | ||
234 | cacheItems[i].TextureAsset = | ||
235 | m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | p.Appearance.WearableCacheItems = cacheItems; | ||
240 | |||
241 | if (m_BakedTextureModule != null) | ||
242 | { | ||
243 | m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); | ||
244 | p.Appearance.WearableCacheItemsDirty = true; | ||
245 | |||
246 | } | ||
247 | else | ||
248 | p.Appearance.WearableCacheItemsDirty = false; | ||
249 | |||
250 | for (int iter = 0; iter < maxCacheitemsLoop; iter++) | ||
251 | { | ||
252 | m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + | ||
253 | cacheItems[iter].TextureID); | ||
254 | } | ||
255 | } | ||
256 | */ | ||
257 | public void PostInitialise() | 108 | public void PostInitialise() |
258 | { | 109 | { |
259 | } | 110 | } |
260 | 111 | ||
261 | |||
262 | |||
263 | public void Close() { } | 112 | public void Close() { } |
264 | 113 | ||
265 | public string Name { get { return "UploadBakedTextureModule"; } } | 114 | public string Name { get { return "UploadBakedTextureModule"; } } |
@@ -275,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
275 | if (m_URL == "localhost") | 124 | if (m_URL == "localhost") |
276 | { | 125 | { |
277 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( | 126 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( |
278 | caps, m_scene.AssetService, m_persistBakedTextures); | 127 | caps, m_scene.AssetService); |
279 | 128 | ||
280 | caps.RegisterHandler( | 129 | caps.RegisterHandler( |
281 | "UploadBakedTexture", | 130 | "UploadBakedTexture", |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 535d946..9553f5b 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -369,7 +369,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
369 | return true; | 369 | return true; |
370 | 370 | ||
371 | // uploaded baked textures will be in assets local cache | 371 | // uploaded baked textures will be in assets local cache |
372 | IAssetService cache = m_scene.AssetService; | 372 | IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>(); |
373 | IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | 373 | IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); |
374 | 374 | ||
375 | int validDirtyBakes = 0; | 375 | int validDirtyBakes = 0; |
@@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
385 | 385 | ||
386 | List<UUID> missing = new List<UUID>(); | 386 | List<UUID> missing = new List<UUID>(); |
387 | 387 | ||
388 | bool haveSkirt = (wearableCache[19].TextureAsset != null); | 388 | bool haveSkirt = (wearableCache[19].TextureID != UUID.Zero); |
389 | bool haveNewSkirt = false; | 389 | bool haveNewSkirt = false; |
390 | 390 | ||
391 | // Process received baked textures | 391 | // Process received baked textures |
@@ -436,7 +436,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
436 | */ | 436 | */ |
437 | wearableCache[idx].TextureAsset = null; | 437 | wearableCache[idx].TextureAsset = null; |
438 | if (cache != null) | 438 | if (cache != null) |
439 | wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString()); | 439 | { |
440 | AssetBase asb = null; | ||
441 | cache.Get(face.TextureID.ToString(), out asb); | ||
442 | wearableCache[idx].TextureAsset = asb; | ||
443 | } | ||
440 | 444 | ||
441 | if (wearableCache[idx].TextureAsset != null) | 445 | if (wearableCache[idx].TextureAsset != null) |
442 | { | 446 | { |
@@ -481,25 +485,26 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
481 | // if we got a full set of baked textures save all in BakedTextureModule | 485 | // if we got a full set of baked textures save all in BakedTextureModule |
482 | if (m_BakedTextureModule != null) | 486 | if (m_BakedTextureModule != null) |
483 | { | 487 | { |
484 | m_log.Debug("[UpdateBakedCache] start async uploading to bakedModule cache"); | 488 | m_log.DebugFormat("[UpdateBakedCache] Uploading to Bakes Server: cache hits: {0} changed entries: {1} rebakes {2}", |
489 | hits.ToString(), validDirtyBakes.ToString(), missing.Count); | ||
485 | 490 | ||
486 | m_BakedTextureModule.Store(sp.UUID, wearableCache); | 491 | m_BakedTextureModule.Store(sp.UUID, wearableCache); |
487 | } | 492 | } |
488 | } | 493 | } |
494 | else | ||
495 | m_log.DebugFormat("[UpdateBakedCache] cache hits: {0} changed entries: {1} rebakes {2}", | ||
496 | hits.ToString(), validDirtyBakes.ToString(), missing.Count); | ||
489 | 497 | ||
490 | |||
491 | // debug | ||
492 | m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString() + " rebakes " + missing.Count); | ||
493 | /* | ||
494 | for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) | 498 | for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) |
495 | { | 499 | { |
496 | int j = AvatarAppearance.BAKE_INDICES[iter]; | 500 | int j = AvatarAppearance.BAKE_INDICES[iter]; |
497 | m_log.Debug("[UpdateBCache] {" + iter + "/" + | 501 | sp.Appearance.WearableCacheItems[j].TextureAsset = null; |
498 | sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + | 502 | // m_log.Debug("[UpdateBCache] {" + iter + "/" + |
499 | sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + | 503 | // sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + |
500 | sp.Appearance.WearableCacheItems[j].TextureID); | 504 | // sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + |
505 | // sp.Appearance.WearableCacheItems[j].TextureID); | ||
501 | } | 506 | } |
502 | */ | 507 | |
503 | return (hits == cacheItems.Length); | 508 | return (hits == cacheItems.Length); |
504 | } | 509 | } |
505 | 510 | ||
@@ -513,7 +518,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
513 | 518 | ||
514 | lock (m_setAppearanceLock) | 519 | lock (m_setAppearanceLock) |
515 | { | 520 | { |
516 | IAssetService cache = m_scene.AssetService; | 521 | IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>(); |
517 | IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | 522 | IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); |
518 | WearableCacheItem[] bakedModuleCache = null; | 523 | WearableCacheItem[] bakedModuleCache = null; |
519 | 524 | ||
@@ -553,6 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
553 | } | 558 | } |
554 | } | 559 | } |
555 | */ | 560 | */ |
561 | |||
556 | bool wearableCacheValid = false; | 562 | bool wearableCacheValid = false; |
557 | if (wearableCache == null) | 563 | if (wearableCache == null) |
558 | { | 564 | { |
@@ -577,10 +583,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
577 | hits++; | 583 | hits++; |
578 | wearableCache[idx].TextureAsset.Temporary = true; | 584 | wearableCache[idx].TextureAsset.Temporary = true; |
579 | wearableCache[idx].TextureAsset.Local = true; | 585 | wearableCache[idx].TextureAsset.Local = true; |
580 | cache.Store(wearableCache[idx].TextureAsset); | 586 | cache.Cache(wearableCache[idx].TextureAsset); |
587 | wearableCache[idx].TextureAsset = null; | ||
581 | continue; | 588 | continue; |
582 | } | 589 | } |
583 | if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null) | 590 | |
591 | if (cache.Check((wearableCache[idx].TextureID).ToString())) | ||
584 | { | 592 | { |
585 | hits++; | 593 | hits++; |
586 | continue; | 594 | continue; |
@@ -645,7 +653,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
645 | wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; | 653 | wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; |
646 | bakedModuleCache[i].TextureAsset.Temporary = true; | 654 | bakedModuleCache[i].TextureAsset.Temporary = true; |
647 | bakedModuleCache[i].TextureAsset.Local = true; | 655 | bakedModuleCache[i].TextureAsset.Local = true; |
648 | cache.Store(bakedModuleCache[i].TextureAsset); | 656 | cache.Cache(bakedModuleCache[i].TextureAsset); |
649 | } | 657 | } |
650 | } | 658 | } |
651 | gotbacked = true; | 659 | gotbacked = true; |
@@ -677,6 +685,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
677 | 685 | ||
678 | face.TextureID = wearableCache[idx].TextureID; | 686 | face.TextureID = wearableCache[idx].TextureID; |
679 | hits++; | 687 | hits++; |
688 | wearableCache[idx].TextureAsset = null; | ||
680 | } | 689 | } |
681 | } | 690 | } |
682 | } | 691 | } |
@@ -706,7 +715,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
706 | return 0; | 715 | return 0; |
707 | 716 | ||
708 | int texturesRebaked = 0; | 717 | int texturesRebaked = 0; |
709 | // IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>(); | 718 | IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>(); |
710 | 719 | ||
711 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) | 720 | for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) |
712 | { | 721 | { |
@@ -722,18 +731,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
722 | 731 | ||
723 | if (missingTexturesOnly) | 732 | if (missingTexturesOnly) |
724 | { | 733 | { |
725 | if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) | 734 | if (cache != null && cache.Check(face.TextureID.ToString())) |
726 | { | 735 | { |
727 | continue; | 736 | continue; |
728 | } | 737 | } |
729 | else | 738 | else |
730 | { | 739 | { |
731 | // On inter-simulator teleports, this occurs if baked textures are not being stored by the | ||
732 | // grid asset service (which means that they are not available to the new region and so have | ||
733 | // to be re-requested from the client). | ||
734 | // | ||
735 | // The only available core OpenSimulator behaviour right now | ||
736 | // is not to store these textures, temporarily or otherwise. | ||
737 | m_log.DebugFormat( | 740 | m_log.DebugFormat( |
738 | "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", | 741 | "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", |
739 | face.TextureID, idx, sp.Name); | 742 | face.TextureID, idx, sp.Name); |
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 89e3020..e02ca49 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -1839,12 +1839,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
1839 | webRequest.ContentType = "application/json-rpc"; | 1839 | webRequest.ContentType = "application/json-rpc"; |
1840 | webRequest.Method = "POST"; | 1840 | webRequest.Method = "POST"; |
1841 | 1841 | ||
1842 | using(Stream dataStream = webRequest.GetRequestStream()) | ||
1843 | dataStream.Write(content,0,content.Length); | ||
1844 | |||
1845 | WebResponse webResponse = null; | 1842 | WebResponse webResponse = null; |
1846 | try | 1843 | try |
1847 | { | 1844 | { |
1845 | using(Stream dataStream = webRequest.GetRequestStream()) | ||
1846 | dataStream.Write(content,0,content.Length); | ||
1847 | |||
1848 | webResponse = webRequest.GetResponse(); | 1848 | webResponse = webRequest.GetResponse(); |
1849 | } | 1849 | } |
1850 | catch (WebException e) | 1850 | catch (WebException e) |
@@ -1920,12 +1920,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
1920 | webRequest.ContentType = "application/json-rpc"; | 1920 | webRequest.ContentType = "application/json-rpc"; |
1921 | webRequest.Method = "POST"; | 1921 | webRequest.Method = "POST"; |
1922 | 1922 | ||
1923 | using(Stream dataStream = webRequest.GetRequestStream()) | ||
1924 | dataStream.Write(content,0,content.Length); | ||
1925 | |||
1926 | WebResponse webResponse = null; | 1923 | WebResponse webResponse = null; |
1927 | try | 1924 | try |
1928 | { | 1925 | { |
1926 | using(Stream dataStream = webRequest.GetRequestStream()) | ||
1927 | dataStream.Write(content,0,content.Length); | ||
1928 | |||
1929 | webResponse = webRequest.GetResponse(); | 1929 | webResponse = webRequest.GetResponse(); |
1930 | } | 1930 | } |
1931 | catch (WebException e) | 1931 | catch (WebException e) |
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 292099d..c0afe7c 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -142,9 +142,9 @@ namespace OpenSim.Region.CoreModules.Framework | |||
142 | 142 | ||
143 | if (capsObjectPath == oldCaps.CapsObjectPath) | 143 | if (capsObjectPath == oldCaps.CapsObjectPath) |
144 | { | 144 | { |
145 | m_log.WarnFormat( | 145 | // m_log.WarnFormat( |
146 | "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", | 146 | // "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", |
147 | agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); | 147 | // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); |
148 | return; | 148 | return; |
149 | } | 149 | } |
150 | else | 150 | else |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ca20604..a1ada4c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
157 | m_idCache = new ExpiringCache<ulong, DateTime>(); | 157 | m_idCache = new ExpiringCache<ulong, DateTime>(); |
158 | m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); | 158 | m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); |
159 | } | 159 | } |
160 | m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); | 160 | m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), extendTime); |
161 | } | 161 | } |
162 | 162 | ||
163 | // Remove the agent from the region's banned list | 163 | // Remove the agent from the region's banned list |
@@ -417,12 +417,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
417 | } | 417 | } |
418 | catch (Exception e) | 418 | catch (Exception e) |
419 | { | 419 | { |
420 | |||
420 | m_log.ErrorFormat( | 421 | m_log.ErrorFormat( |
421 | "[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}", | 422 | "[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}", |
422 | sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, | 423 | sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, |
423 | e.Message, e.StackTrace); | 424 | e.Message, e.StackTrace); |
424 | 425 | if(sp != null && sp.ControllingClient != null && !sp.IsDeleted) | |
425 | sp.ControllingClient.SendTeleportFailed("Internal error"); | 426 | sp.ControllingClient.SendTeleportFailed("Internal error"); |
426 | } | 427 | } |
427 | finally | 428 | finally |
428 | { | 429 | { |
@@ -1216,7 +1217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1216 | // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR | 1217 | // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR |
1217 | // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS. | 1218 | // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS. |
1218 | 1219 | ||
1219 | Thread.Sleep(15000); | 1220 | Thread.Sleep(25000); |
1220 | // if (m_eqModule != null && !sp.DoNotCloseAfterTeleport) | 1221 | // if (m_eqModule != null && !sp.DoNotCloseAfterTeleport) |
1221 | // m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID); | 1222 | // m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID); |
1222 | // Thread.Sleep(1000); | 1223 | // Thread.Sleep(1000); |
@@ -1487,11 +1488,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1487 | Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); | 1488 | Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); |
1488 | 1489 | ||
1489 | if (neighbourRegion == null) | 1490 | if (neighbourRegion == null) |
1490 | { | ||
1491 | return null; | 1491 | return null; |
1492 | } | 1492 | |
1493 | if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) | 1493 | if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) |
1494 | { | 1494 | { |
1495 | failureReason = "Access Denied or Temporary not possible"; | ||
1495 | return null; | 1496 | return null; |
1496 | } | 1497 | } |
1497 | 1498 | ||
@@ -1503,13 +1504,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1503 | pos.Z); | 1504 | pos.Z); |
1504 | 1505 | ||
1505 | string homeURI = scene.GetAgentHomeURI(agentID); | 1506 | string homeURI = scene.GetAgentHomeURI(agentID); |
1506 | 1507 | ||
1507 | if (!scene.SimulationService.QueryAccess( | 1508 | if (!scene.SimulationService.QueryAccess( |
1508 | neighbourRegion, agentID, homeURI, false, newpos, | 1509 | neighbourRegion, agentID, homeURI, false, newpos, |
1509 | scene.GetFormatsOffered(), ctx, out failureReason)) | 1510 | scene.GetFormatsOffered(), ctx, out failureReason)) |
1510 | { | 1511 | { |
1511 | // remember the fail | 1512 | // remember the fail |
1512 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | 1513 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); |
1514 | if(String.IsNullOrWhiteSpace(failureReason)) | ||
1515 | failureReason = "Access Denied"; | ||
1513 | return null; | 1516 | return null; |
1514 | } | 1517 | } |
1515 | 1518 | ||
@@ -1529,13 +1532,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1529 | CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState; | 1532 | CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState; |
1530 | ScenePresence agent = icon.EndInvoke(iar); | 1533 | ScenePresence agent = icon.EndInvoke(iar); |
1531 | 1534 | ||
1532 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | ||
1533 | 1535 | ||
1534 | if(!agent.IsChildAgent) | 1536 | if(!agent.IsChildAgent) |
1535 | { | 1537 | { |
1536 | // crossing failed | 1538 | // crossing failed |
1537 | agent.CrossToNewRegionFail(); | 1539 | agent.CrossToNewRegionFail(); |
1538 | } | 1540 | } |
1541 | else | ||
1542 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); | ||
1543 | |||
1539 | agent.IsInTransit = false; | 1544 | agent.IsInTransit = false; |
1540 | } | 1545 | } |
1541 | 1546 | ||
@@ -2153,6 +2158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2153 | { | 2158 | { |
2154 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start | 2159 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start |
2155 | int count = 0; | 2160 | int count = 0; |
2161 | IPEndPoint ipe; | ||
2156 | 2162 | ||
2157 | foreach (GridRegion neighbour in neighbours) | 2163 | foreach (GridRegion neighbour in neighbours) |
2158 | { | 2164 | { |
@@ -2161,8 +2167,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2161 | { | 2167 | { |
2162 | if (newneighbours.Contains(handler)) | 2168 | if (newneighbours.Contains(handler)) |
2163 | { | 2169 | { |
2164 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, | 2170 | ipe = neighbour.ExternalEndPoint; |
2165 | neighbour.ExternalEndPoint, true); | 2171 | if (ipe != null) |
2172 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); | ||
2173 | else | ||
2174 | { | ||
2175 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: lost DNS resolution for neighbour {0}", neighbour.ExternalHostName); | ||
2176 | } | ||
2166 | count++; | 2177 | count++; |
2167 | } | 2178 | } |
2168 | else if (!previousRegionNeighbourHandles.Contains(handler)) | 2179 | else if (!previousRegionNeighbourHandles.Contains(handler)) |
@@ -2278,9 +2289,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2278 | protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, | 2289 | protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, |
2279 | double px, double py, uint pSizeHint) | 2290 | double px, double py, uint pSizeHint) |
2280 | { | 2291 | { |
2281 | m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); | 2292 | // m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); |
2282 | GridRegion ret = null; | 2293 | GridRegion ret = null; |
2283 | const double fudge = 2.0; | ||
2284 | 2294 | ||
2285 | if (m_notFoundLocationCache.Contains(px, py)) | 2295 | if (m_notFoundLocationCache.Contains(px, py)) |
2286 | { | 2296 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 66ebdbe..5f72733 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -35,6 +35,7 @@ using log4net; | |||
35 | using Mono.Addins; | 35 | using Mono.Addins; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
39 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
@@ -146,23 +147,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
146 | } | 147 | } |
147 | 148 | ||
148 | IPAddress ia = null; | 149 | IPAddress ia = null; |
149 | try | 150 | ia = Util.GetHostFromDNS(ExternalHostNameForLSL); |
150 | { | ||
151 | foreach (IPAddress Adr in Dns.GetHostAddresses(ExternalHostNameForLSL)) | ||
152 | { | ||
153 | if (Adr.AddressFamily == AddressFamily.InterNetwork || | ||
154 | Adr.AddressFamily == AddressFamily.InterNetworkV6) // ipv6 will most likely smoke | ||
155 | { | ||
156 | ia = Adr; | ||
157 | break; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | catch | ||
162 | { | ||
163 | ia = null; | ||
164 | } | ||
165 | |||
166 | if (ia == null) | 151 | if (ia == null) |
167 | { | 152 | { |
168 | m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled"; | 153 | m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled"; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs index e8d01b0..60addec 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs | |||
@@ -25,44 +25,32 @@ | |||
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 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | 28 | using log4net; |
32 | using Mono.Addins; | 29 | using Mono.Addins; |
30 | using System; | ||
31 | using System.Reflection; | ||
32 | using System.Collections.Generic; | ||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
36 | using OpenSim.Server.Base; | 35 | using OpenSim.Services.Connectors; |
37 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
40 | 39 | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour |
42 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalNeighbourServicesConnector")] | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NeighbourServicesOutConnector")] |
44 | public class LocalNeighbourServicesConnector : | 44 | public class NeighbourServicesOutConnector : |
45 | ISharedRegionModule, INeighbourService | 45 | NeighbourServicesConnector, ISharedRegionModule, INeighbourService |
46 | { | 46 | { |
47 | private static readonly ILog m_log = | 47 | private static readonly ILog m_log = |
48 | LogManager.GetLogger( | 48 | LogManager.GetLogger( |
49 | MethodBase.GetCurrentMethod().DeclaringType); | 49 | MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private List<Scene> m_Scenes = new List<Scene>(); | 51 | private List<Scene> m_Scenes = new List<Scene>(); |
52 | |||
53 | private bool m_Enabled = false; | 52 | private bool m_Enabled = false; |
54 | 53 | ||
55 | public LocalNeighbourServicesConnector() | ||
56 | { | ||
57 | } | ||
58 | |||
59 | public LocalNeighbourServicesConnector(List<Scene> scenes) | ||
60 | { | ||
61 | m_Scenes = scenes; | ||
62 | } | ||
63 | |||
64 | #region ISharedRegionModule | ||
65 | |||
66 | public Type ReplaceableInterface | 54 | public Type ReplaceableInterface |
67 | { | 55 | { |
68 | get { return null; } | 56 | get { return null; } |
@@ -70,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | |||
70 | 58 | ||
71 | public string Name | 59 | public string Name |
72 | { | 60 | { |
73 | get { return "LocalNeighbourServicesConnector"; } | 61 | get { return "NeighbourServicesOutConnector"; } |
74 | } | 62 | } |
75 | 63 | ||
76 | public void Initialise(IConfigSource source) | 64 | public void Initialise(IConfigSource source) |
@@ -78,39 +66,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | |||
78 | IConfig moduleConfig = source.Configs["Modules"]; | 66 | IConfig moduleConfig = source.Configs["Modules"]; |
79 | if (moduleConfig != null) | 67 | if (moduleConfig != null) |
80 | { | 68 | { |
81 | string name = moduleConfig.GetString("NeighbourServices", this.Name); | 69 | string name = moduleConfig.GetString("NeighbourServices"); |
82 | if (name == Name) | 70 | if (name == Name) |
83 | { | 71 | { |
84 | // m_Enabled rules whether this module registers as INeighbourService or not | ||
85 | m_Enabled = true; | 72 | m_Enabled = true; |
86 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled"); | 73 | m_log.Info("[NEIGHBOUR CONNECTOR]: Neighbour out connector enabled"); |
87 | } | 74 | } |
88 | } | 75 | } |
89 | } | 76 | } |
90 | 77 | ||
78 | public void PostInitialise() | ||
79 | { | ||
80 | } | ||
81 | |||
91 | public void Close() | 82 | public void Close() |
92 | { | 83 | { |
93 | } | 84 | } |
94 | 85 | ||
95 | public void AddRegion(Scene scene) | 86 | public void AddRegion(Scene scene) |
96 | { | 87 | { |
97 | m_Scenes.Add(scene); | ||
98 | |||
99 | if (!m_Enabled) | 88 | if (!m_Enabled) |
100 | return; | 89 | return; |
101 | 90 | ||
91 | m_Scenes.Add(scene); | ||
102 | scene.RegisterModuleInterface<INeighbourService>(this); | 92 | scene.RegisterModuleInterface<INeighbourService>(this); |
103 | } | 93 | } |
104 | 94 | ||
105 | public void RegionLoaded(Scene scene) | ||
106 | { | ||
107 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled for region " + scene.RegionInfo.RegionName); | ||
108 | } | ||
109 | |||
110 | public void PostInitialise() | ||
111 | { | ||
112 | } | ||
113 | |||
114 | public void RemoveRegion(Scene scene) | 95 | public void RemoveRegion(Scene scene) |
115 | { | 96 | { |
116 | // Always remove | 97 | // Always remove |
@@ -118,28 +99,36 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | |||
118 | m_Scenes.Remove(scene); | 99 | m_Scenes.Remove(scene); |
119 | } | 100 | } |
120 | 101 | ||
121 | #endregion ISharedRegionModule | 102 | public void RegionLoaded(Scene scene) |
103 | { | ||
104 | if (!m_Enabled) | ||
105 | return; | ||
106 | |||
107 | m_GridService = scene.GridService; | ||
108 | m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled out neighbours for region {0}", scene.RegionInfo.RegionName); | ||
109 | |||
110 | } | ||
122 | 111 | ||
123 | #region INeighbourService | 112 | #region INeighbourService |
124 | 113 | ||
125 | public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 114 | public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
126 | { | 115 | { |
127 | uint x, y; | 116 | if (!m_Enabled) |
128 | Util.RegionHandleToRegionLoc(regionHandle, out x, out y); | 117 | return null; |
129 | 118 | ||
130 | foreach (Scene s in m_Scenes) | 119 | foreach (Scene s in m_Scenes) |
131 | { | 120 | { |
132 | if (s.RegionInfo.RegionHandle == regionHandle) | 121 | if (s.RegionInfo.RegionHandle == regionHandle) |
133 | { | 122 | { |
134 | m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", | 123 | // uint x, y; |
135 | thisRegion.RegionName, s.Name, x, y ); | 124 | // Util.RegionHandleToRegionLoc(regionHandle, out x, out y); |
136 | 125 | // m_log.DebugFormat("[NEIGHBOUR SERVICE OUT CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", | |
137 | //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); | 126 | // thisRegion.RegionName, s.Name, x, y ); |
138 | return s.IncomingHelloNeighbour(thisRegion); | 127 | return s.IncomingHelloNeighbour(thisRegion); |
139 | } | 128 | } |
140 | } | 129 | } |
141 | //m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); | 130 | |
142 | return null; | 131 | return base.HelloNeighbour(regionHandle, thisRegion); |
143 | } | 132 | } |
144 | 133 | ||
145 | #endregion INeighbourService | 134 | #endregion INeighbourService |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs deleted file mode 100644 index fcb5521..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs +++ /dev/null | |||
@@ -1,157 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using Mono.Addins; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Services.Connectors; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenSim.Server.Base; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | ||
42 | { | ||
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteNeighbourServicesConnector")] | ||
44 | public class RemoteNeighbourServicesConnector : | ||
45 | NeighbourServicesConnector, ISharedRegionModule, INeighbourService | ||
46 | { | ||
47 | private static readonly ILog m_log = | ||
48 | LogManager.GetLogger( | ||
49 | MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private bool m_Enabled = false; | ||
52 | private LocalNeighbourServicesConnector m_LocalService; | ||
53 | //private string serviceDll; | ||
54 | //private List<Scene> m_Scenes = new List<Scene>(); | ||
55 | |||
56 | public Type ReplaceableInterface | ||
57 | { | ||
58 | get { return null; } | ||
59 | } | ||
60 | |||
61 | public string Name | ||
62 | { | ||
63 | get { return "RemoteNeighbourServicesConnector"; } | ||
64 | } | ||
65 | |||
66 | public void Initialise(IConfigSource source) | ||
67 | { | ||
68 | IConfig moduleConfig = source.Configs["Modules"]; | ||
69 | if (moduleConfig != null) | ||
70 | { | ||
71 | string name = moduleConfig.GetString("NeighbourServices"); | ||
72 | if (name == Name) | ||
73 | { | ||
74 | m_LocalService = new LocalNeighbourServicesConnector(); | ||
75 | |||
76 | //IConfig neighbourConfig = source.Configs["NeighbourService"]; | ||
77 | //if (neighbourConfig == null) | ||
78 | //{ | ||
79 | // m_log.Error("[NEIGHBOUR CONNECTOR]: NeighbourService missing from OpenSim.ini"); | ||
80 | // return; | ||
81 | //} | ||
82 | //serviceDll = neighbourConfig.GetString("LocalServiceModule", String.Empty); | ||
83 | //if (serviceDll == String.Empty) | ||
84 | //{ | ||
85 | // m_log.Error("[NEIGHBOUR CONNECTOR]: No LocalServiceModule named in section NeighbourService"); | ||
86 | // return; | ||
87 | //} | ||
88 | |||
89 | m_Enabled = true; | ||
90 | |||
91 | m_log.Info("[NEIGHBOUR CONNECTOR]: Remote Neighbour connector enabled"); | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public void PostInitialise() | ||
97 | { | ||
98 | //if (m_Enabled) | ||
99 | //{ | ||
100 | // Object[] args = new Object[] { m_Scenes }; | ||
101 | // m_LocalService = | ||
102 | // ServerUtils.LoadPlugin<INeighbourService>(serviceDll, | ||
103 | // args); | ||
104 | |||
105 | // if (m_LocalService == null) | ||
106 | // { | ||
107 | // m_log.Error("[NEIGHBOUR CONNECTOR]: Can't load neighbour service"); | ||
108 | // Unregister(); | ||
109 | // return; | ||
110 | // } | ||
111 | //} | ||
112 | } | ||
113 | |||
114 | public void Close() | ||
115 | { | ||
116 | } | ||
117 | |||
118 | public void AddRegion(Scene scene) | ||
119 | { | ||
120 | if (!m_Enabled) | ||
121 | return; | ||
122 | |||
123 | m_LocalService.AddRegion(scene); | ||
124 | scene.RegisterModuleInterface<INeighbourService>(this); | ||
125 | } | ||
126 | |||
127 | public void RemoveRegion(Scene scene) | ||
128 | { | ||
129 | if (m_Enabled) | ||
130 | m_LocalService.RemoveRegion(scene); | ||
131 | } | ||
132 | |||
133 | public void RegionLoaded(Scene scene) | ||
134 | { | ||
135 | if (!m_Enabled) | ||
136 | return; | ||
137 | |||
138 | m_GridService = scene.GridService; | ||
139 | |||
140 | m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName); | ||
141 | |||
142 | } | ||
143 | |||
144 | #region INeighbourService | ||
145 | |||
146 | public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | ||
147 | { | ||
148 | GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion); | ||
149 | if (region != null) | ||
150 | return region; | ||
151 | |||
152 | return base.HelloNeighbour(regionHandle, thisRegion); | ||
153 | } | ||
154 | |||
155 | #endregion INeighbourService | ||
156 | } | ||
157 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index f16fd01..4d7a698 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Globalization; | 30 | using System.Globalization; |
31 | using System.Text; | ||
31 | using System.Text.RegularExpressions; | 32 | using System.Text.RegularExpressions; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | 34 | ||
@@ -525,7 +526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
525 | } | 526 | } |
526 | 527 | ||
527 | [Serializable] | 528 | [Serializable] |
528 | public struct list | 529 | public class list |
529 | { | 530 | { |
530 | private object[] m_data; | 531 | private object[] m_data; |
531 | 532 | ||
@@ -1152,34 +1153,35 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1152 | 1153 | ||
1153 | public string ToCSV() | 1154 | public string ToCSV() |
1154 | { | 1155 | { |
1155 | string ret = ""; | 1156 | if(m_data == null || m_data.Length == 0) |
1156 | foreach (object o in this.Data) | 1157 | return String.Empty; |
1158 | |||
1159 | Object o = m_data[0]; | ||
1160 | int len = m_data.Length; | ||
1161 | if(len == 1) | ||
1162 | return o.ToString(); | ||
1163 | |||
1164 | StringBuilder sb = new StringBuilder(1024); | ||
1165 | sb.Append(o.ToString()); | ||
1166 | for(int i = 1 ; i < len; i++) | ||
1157 | { | 1167 | { |
1158 | if (ret == "") | 1168 | sb.Append(","); |
1159 | { | 1169 | sb.Append(o.ToString()); |
1160 | ret = o.ToString(); | ||
1161 | } | ||
1162 | else | ||
1163 | { | ||
1164 | ret = ret + ", " + o.ToString(); | ||
1165 | } | ||
1166 | } | 1170 | } |
1167 | return ret; | 1171 | return sb.ToString(); |
1168 | } | 1172 | } |
1169 | 1173 | ||
1170 | private string ToSoup() | 1174 | private string ToSoup() |
1171 | { | 1175 | { |
1172 | string output; | 1176 | if(m_data == null || m_data.Length == 0) |
1173 | output = String.Empty; | ||
1174 | if (Data.Length == 0) | ||
1175 | { | ||
1176 | return String.Empty; | 1177 | return String.Empty; |
1177 | } | 1178 | |
1178 | foreach (object o in Data) | 1179 | StringBuilder sb = new StringBuilder(1024); |
1180 | foreach (object o in m_data) | ||
1179 | { | 1181 | { |
1180 | output = output + o.ToString(); | 1182 | sb.Append(o.ToString()); |
1181 | } | 1183 | } |
1182 | return output; | 1184 | return sb.ToString(); |
1183 | } | 1185 | } |
1184 | 1186 | ||
1185 | public static explicit operator String(list l) | 1187 | public static explicit operator String(list l) |
@@ -1369,26 +1371,33 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1369 | 1371 | ||
1370 | public string ToPrettyString() | 1372 | public string ToPrettyString() |
1371 | { | 1373 | { |
1372 | string output; | 1374 | if(m_data == null || m_data.Length == 0) |
1373 | if (Data.Length == 0) | ||
1374 | { | ||
1375 | return "[]"; | 1375 | return "[]"; |
1376 | } | 1376 | |
1377 | output = "["; | 1377 | StringBuilder sb = new StringBuilder(1024); |
1378 | foreach (object o in Data) | 1378 | int len = m_data.Length; |
1379 | int last = len - 1; | ||
1380 | object o; | ||
1381 | |||
1382 | sb.Append("["); | ||
1383 | for(int i = 0; i < len; i++ ) | ||
1379 | { | 1384 | { |
1385 | o = m_data[i]; | ||
1380 | if (o is String) | 1386 | if (o is String) |
1381 | { | 1387 | { |
1382 | output = output + "\"" + o + "\", "; | 1388 | sb.Append("\""); |
1389 | sb.Append((String)o); | ||
1390 | sb.Append("\""); | ||
1383 | } | 1391 | } |
1384 | else | 1392 | else |
1385 | { | 1393 | { |
1386 | output = output + o.ToString() + ", "; | 1394 | sb.Append(o.ToString()); |
1387 | } | 1395 | } |
1396 | if(i < last) | ||
1397 | sb.Append(","); | ||
1388 | } | 1398 | } |
1389 | output = output.Substring(0, output.Length - 2); | 1399 | sb.Append("]"); |
1390 | output = output + "]"; | 1400 | return sb.ToString(); |
1391 | return output; | ||
1392 | } | 1401 | } |
1393 | 1402 | ||
1394 | public class AlphaCompare : IComparer | 1403 | public class AlphaCompare : IComparer |
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 5c99ab7..4b7fd8a 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs | |||
@@ -82,8 +82,7 @@ namespace OpenSim.Server | |||
82 | ServicePointManager.UseNagleAlgorithm = false; | 82 | ServicePointManager.UseNagleAlgorithm = false; |
83 | ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; | 83 | ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; |
84 | 84 | ||
85 | try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity | 85 | try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { } |
86 | catch { } | ||
87 | 86 | ||
88 | m_Server = new HttpServerBase("R.O.B.U.S.T.", args); | 87 | m_Server = new HttpServerBase("R.O.B.U.S.T.", args); |
89 | 88 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index b261675..f2bb52a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -70,9 +70,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
70 | { | 70 | { |
71 | Uri m_Uri = new Uri(m_ServerURL); | 71 | Uri m_Uri = new Uri(m_ServerURL); |
72 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); | 72 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); |
73 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); | 73 | if(ip != null) |
74 | if (!m_ServerURL.EndsWith("/")) | 74 | { |
75 | m_ServerURL += "/"; | 75 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); |
76 | if (!m_ServerURL.EndsWith("/")) | ||
77 | m_ServerURL += "/"; | ||
78 | } | ||
79 | else | ||
80 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Failed to resolv address of {0}", url); | ||
76 | } | 81 | } |
77 | catch (Exception e) | 82 | catch (Exception e) |
78 | { | 83 | { |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 9f4d89a..a4ca2d3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -295,9 +295,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
295 | 295 | ||
296 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); | 296 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); |
297 | 297 | ||
298 | IPEndPoint ext = destination.ExternalEndPoint; | ||
299 | if (ext == null) return false; | ||
300 | |||
301 | // Eventually, we want to use a caps url instead of the agentID | 298 | // Eventually, we want to use a caps url instead of the agentID |
302 | string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; | 299 | string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; |
303 | 300 | ||