aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-07-11 23:05:10 +0100
committerJustin Clark-Casey (justincc)2013-07-11 23:05:10 +0100
commitf57f49eedeee28f9ee47a29ffbfb328fcae3cfa5 (patch)
tree8f8d71b5740e06526f1eb43e9b44461d7b12b807
parentFix regression where llHTTPRequests which did not get an OK response returned... (diff)
parentAdded property to make for more flexible testing. (diff)
downloadopensim-SC_OLD-f57f49eedeee28f9ee47a29ffbfb328fcae3cfa5.zip
opensim-SC_OLD-f57f49eedeee28f9ee47a29ffbfb328fcae3cfa5.tar.gz
opensim-SC_OLD-f57f49eedeee28f9ee47a29ffbfb328fcae3cfa5.tar.bz2
opensim-SC_OLD-f57f49eedeee28f9ee47a29ffbfb328fcae3cfa5.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs12
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs5
-rw-r--r--OpenSim/Tests/Clients/Assets/AssetsClient.cs99
-rw-r--r--prebuild.xml27
4 files changed, 136 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 161f160..c04098c 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -173,7 +173,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
173 if(obj.PresenceType == PresenceType.Npc) 173 if(obj.PresenceType == PresenceType.Npc)
174 return; 174 return;
175 175
176 GetImageAssets(((IScenePresence)obj).UUID); 176 Util.FireAndForget(delegate
177 {
178 GetImageAssets(((IScenePresence)obj).UUID);
179 });
177 } 180 }
178 181
179 /// <summary> 182 /// <summary>
@@ -1044,12 +1047,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1044 { 1047 {
1045 OSDString assetId = (OSDString)asset; 1048 OSDString assetId = (OSDString)asset;
1046 1049
1047 Scene.AssetService.Get(string.Format("{0}/{1}",assetServerURI, assetId.AsString()), this, 1050 Scene.AssetService.Get(string.Format("{0}/{1}",assetServerURI, assetId.AsString()));
1048 delegate (string assetID, Object s, AssetBase a)
1049 {
1050 // m_log.DebugFormat("[PROFILES]: Getting Image Assets {0}", assetID);
1051 return;
1052 });
1053 } 1051 }
1054 return true; 1052 return true;
1055 } 1053 }
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 7f7f251..8b04d7f 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -55,6 +55,11 @@ namespace OpenSim.Services.Connectors
55 // Maps: Asset ID -> Handlers which will be called when the asset has been loaded 55 // Maps: Asset ID -> Handlers which will be called when the asset has been loaded
56 private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); 56 private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>();
57 57
58 public int MaxAssetRequestConcurrency
59 {
60 get { return m_maxAssetRequestConcurrency; }
61 set { m_maxAssetRequestConcurrency = value; }
62 }
58 63
59 public AssetServicesConnector() 64 public AssetServicesConnector()
60 { 65 {
diff --git a/OpenSim/Tests/Clients/Assets/AssetsClient.cs b/OpenSim/Tests/Clients/Assets/AssetsClient.cs
new file mode 100644
index 0000000..dd168a1
--- /dev/null
+++ b/OpenSim/Tests/Clients/Assets/AssetsClient.cs
@@ -0,0 +1,99 @@
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
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Text;
32using System.Reflection;
33using System.Threading;
34
35using OpenMetaverse;
36using log4net;
37using log4net.Appender;
38using log4net.Layout;
39
40using OpenSim.Framework;
41using OpenSim.Services.Interfaces;
42using OpenSim.Services.Connectors;
43
44namespace OpenSim.Tests.Clients.AssetsClient
45{
46 public class AssetsClient
47 {
48 private static readonly ILog m_log =
49 LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType);
51
52 private static int m_MaxThreadID = 0;
53 private static readonly int NREQS = 150;
54 private static int m_NReceived = 0;
55
56 public static void Main(string[] args)
57 {
58 ConsoleAppender consoleAppender = new ConsoleAppender();
59 consoleAppender.Layout =
60 new PatternLayout("[%thread] - %message%newline");
61 log4net.Config.BasicConfigurator.Configure(consoleAppender);
62
63 string serverURI = "http://127.0.0.1:8003";
64 if (args.Length > 1)
65 serverURI = args[1];
66 int max1, max2;
67 ThreadPool.GetMaxThreads(out max1, out max2);
68 m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} max threads = {1} - {2}", serverURI, max1, max2);
69 ThreadPool.GetMinThreads(out max1, out max2);
70 m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} min threads = {1} - {2}", serverURI, max1, max2);
71 ThreadPool.SetMinThreads(1, 1);
72 ThreadPool.SetMaxThreads(10, 3);
73 ServicePointManager.DefaultConnectionLimit = 12;
74
75 AssetServicesConnector m_Connector = new AssetServicesConnector(serverURI);
76 m_Connector.MaxAssetRequestConcurrency = 30;
77
78 for (int i = 0; i < NREQS; i++)
79 {
80 UUID uuid = UUID.Random();
81 m_Connector.Get(uuid.ToString(), null, ResponseReceived);
82 m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid);
83 }
84
85 Thread.Sleep(20 * 1000);
86 m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived);
87 }
88
89 private static void ResponseReceived(string id, Object sender, AssetBase asset)
90 {
91 if (Thread.CurrentThread.ManagedThreadId > m_MaxThreadID)
92 m_MaxThreadID = Thread.CurrentThread.ManagedThreadId;
93 int max1, max2;
94 ThreadPool.GetAvailableThreads(out max1, out max2);
95 m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3})", id, m_MaxThreadID, max1, max2);
96 m_NReceived++;
97 }
98 }
99}
diff --git a/prebuild.xml b/prebuild.xml
index d32287a..91c326c 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -2631,6 +2631,33 @@
2631 </Project> 2631 </Project>
2632 2632
2633 <!-- Test Clients --> 2633 <!-- Test Clients -->
2634 <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.AssetClient" path="OpenSim/Tests/Clients/Assets" type="Exe">
2635 <Configuration name="Debug">
2636 <Options>
2637 <OutputPath>../../../../bin/</OutputPath>
2638 </Options>
2639 </Configuration>
2640 <Configuration name="Release">
2641 <Options>
2642 <OutputPath>../../../../bin/</OutputPath>
2643 </Options>
2644 </Configuration>
2645
2646 <ReferencePath>../../../../bin/</ReferencePath>
2647 <Reference name="System"/>
2648 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
2649 <Reference name="OpenMetaverse" path="../../../../bin/"/>
2650 <Reference name="OpenSim.Framework"/>
2651 <Reference name="OpenSim.Services.Interfaces"/>
2652 <Reference name="OpenSim.Services.Connectors"/>
2653 <Reference name="Nini" path="../../../../bin/"/>
2654 <Reference name="log4net" path="../../../../bin/"/>
2655
2656 <Files>
2657 <Match pattern="*.cs" recurse="true"/>
2658 </Files>
2659 </Project>
2660
2634 <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe"> 2661 <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe">
2635 <Configuration name="Debug"> 2662 <Configuration name="Debug">
2636 <Options> 2663 <Options>