diff options
Diffstat (limited to 'OpenSim')
25 files changed, 823 insertions, 451 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index e1b4fe7..245d931 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -350,7 +350,5 @@ namespace OpenSim.Capabilities.Handlers | |||
350 | } | 350 | } |
351 | return null; | 351 | return null; |
352 | } | 352 | } |
353 | |||
354 | |||
355 | } | 353 | } |
356 | } | 354 | } \ No newline at end of file |
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs new file mode 100644 index 0000000..b89fd6a --- /dev/null +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs | |||
@@ -0,0 +1,183 @@ | |||
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 System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Specialized; | ||
31 | using System.Drawing; | ||
32 | using System.Drawing.Imaging; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Web; | ||
36 | using log4net; | ||
37 | using Nini.Config; | ||
38 | using OpenMetaverse; | ||
39 | using OpenMetaverse.StructuredData; | ||
40 | using OpenMetaverse.Imaging; | ||
41 | using OpenSim.Framework; | ||
42 | using OpenSim.Framework.Capabilities; | ||
43 | using OpenSim.Framework.Servers; | ||
44 | using OpenSim.Framework.Servers.HttpServer; | ||
45 | using OpenSim.Region.Framework.Interfaces; | ||
46 | using OpenSim.Services.Interfaces; | ||
47 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
48 | |||
49 | namespace OpenSim.Capabilities.Handlers | ||
50 | { | ||
51 | public class UploadBakedTextureHandler | ||
52 | { | ||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | |||
55 | private Caps m_HostCapsObj; | ||
56 | private IAssetService m_assetService; | ||
57 | private bool m_persistBakedTextures; | ||
58 | |||
59 | public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures) | ||
60 | { | ||
61 | m_HostCapsObj = caps; | ||
62 | m_assetService = assetService; | ||
63 | m_persistBakedTextures = persistBakedTextures; | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Handle a request from the client for a Uri to upload a baked texture. | ||
68 | /// </summary> | ||
69 | /// <param name="request"></param> | ||
70 | /// <param name="path"></param> | ||
71 | /// <param name="param"></param> | ||
72 | /// <param name="httpRequest"></param> | ||
73 | /// <param name="httpResponse"></param> | ||
74 | /// <returns>The upload response if the request is successful, null otherwise.</returns> | ||
75 | public string UploadBakedTexture( | ||
76 | string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
77 | { | ||
78 | try | ||
79 | { | ||
80 | // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName); | ||
81 | |||
82 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
83 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
84 | |||
85 | BakedTextureUploader uploader = | ||
86 | new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener); | ||
87 | uploader.OnUpLoad += BakedTextureUploaded; | ||
88 | |||
89 | m_HostCapsObj.HttpListener.AddStreamHandler( | ||
90 | new BinaryStreamHandler("POST", capsBase + uploaderPath, | ||
91 | uploader.uploaderCaps)); | ||
92 | |||
93 | string protocol = "http://"; | ||
94 | |||
95 | if (m_HostCapsObj.SSLCaps) | ||
96 | protocol = "https://"; | ||
97 | |||
98 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + | ||
99 | m_HostCapsObj.Port.ToString() + capsBase + uploaderPath; | ||
100 | |||
101 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
102 | uploadResponse.uploader = uploaderURL; | ||
103 | uploadResponse.state = "upload"; | ||
104 | |||
105 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
106 | } | ||
107 | catch (Exception e) | ||
108 | { | ||
109 | m_log.Error("[UPLOAD BAKED TEXTURE HANDLER]: " + e.ToString()); | ||
110 | } | ||
111 | |||
112 | return null; | ||
113 | } | ||
114 | |||
115 | /// <summary> | ||
116 | /// Called when a baked texture has been successfully uploaded by a client. | ||
117 | /// </summary> | ||
118 | /// <param name="assetID"></param> | ||
119 | /// <param name="data"></param> | ||
120 | private void BakedTextureUploaded(UUID assetID, byte[] data) | ||
121 | { | ||
122 | // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | ||
123 | |||
124 | AssetBase asset; | ||
125 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); | ||
126 | asset.Data = data; | ||
127 | asset.Temporary = true; | ||
128 | asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are | ||
129 | m_assetService.Store(asset); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | class BakedTextureUploader | ||
134 | { | ||
135 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
136 | |||
137 | public event Action<UUID, byte[]> OnUpLoad; | ||
138 | |||
139 | private string uploaderPath = String.Empty; | ||
140 | private UUID newAssetID; | ||
141 | private IHttpServer httpListener; | ||
142 | |||
143 | public BakedTextureUploader(string path, IHttpServer httpServer) | ||
144 | { | ||
145 | newAssetID = UUID.Random(); | ||
146 | uploaderPath = path; | ||
147 | httpListener = httpServer; | ||
148 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); | ||
149 | } | ||
150 | |||
151 | /// <summary> | ||
152 | /// Handle raw uploaded baked texture data. | ||
153 | /// </summary> | ||
154 | /// <param name="data"></param> | ||
155 | /// <param name="path"></param> | ||
156 | /// <param name="param"></param> | ||
157 | /// <returns></returns> | ||
158 | public string uploaderCaps(byte[] data, string path, string param) | ||
159 | { | ||
160 | Action<UUID, byte[]> handlerUpLoad = OnUpLoad; | ||
161 | |||
162 | // Don't do this asynchronously, otherwise it's possible for the client to send set appearance information | ||
163 | // on another thread which might send out avatar updates before the asset has been put into the asset | ||
164 | // service. | ||
165 | if (handlerUpLoad != null) | ||
166 | handlerUpLoad(newAssetID, data); | ||
167 | |||
168 | string res = String.Empty; | ||
169 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
170 | uploadComplete.new_asset = newAssetID.ToString(); | ||
171 | uploadComplete.new_inventory_item = UUID.Zero; | ||
172 | uploadComplete.state = "complete"; | ||
173 | |||
174 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
175 | |||
176 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
177 | |||
178 | // m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID); | ||
179 | |||
180 | return res; | ||
181 | } | ||
182 | } | ||
183 | } \ No newline at end of file | ||
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 9d09af7..deb50cb 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs | |||
@@ -40,24 +40,40 @@ namespace OpenSim.Data.Null | |||
40 | { | 40 | { |
41 | private static NullRegionData Instance = null; | 41 | private static NullRegionData Instance = null; |
42 | 42 | ||
43 | /// <summary> | ||
44 | /// Should we use the static instance for all invocations? | ||
45 | /// </summary> | ||
46 | private bool m_useStaticInstance = true; | ||
47 | |||
43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 49 | ||
45 | Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); | 50 | Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); |
46 | 51 | ||
47 | public NullRegionData(string connectionString, string realm) | 52 | public NullRegionData(string connectionString, string realm) |
48 | { | 53 | { |
49 | if (Instance == null) | 54 | // m_log.DebugFormat( |
55 | // "[NULL REGION DATA]: Constructor got connectionString {0}, realm {1}", connectionString, realm); | ||
56 | |||
57 | // The !static connection string is a hack so that regression tests can use this module without a high degree of fragility | ||
58 | // in having to deal with the static reference in the once-loaded NullRegionData class. | ||
59 | // | ||
60 | // In standalone operation, we have to use only one instance of this class since the login service and | ||
61 | // simulator have no other way of using a common data store. | ||
62 | if (connectionString == "!static") | ||
63 | m_useStaticInstance = false; | ||
64 | else if (Instance == null) | ||
50 | Instance = this; | 65 | Instance = this; |
51 | //Console.WriteLine("[XXX] NullRegionData constructor"); | ||
52 | } | 66 | } |
53 | 67 | ||
54 | private delegate bool Matcher(string value); | 68 | private delegate bool Matcher(string value); |
55 | 69 | ||
56 | public List<RegionData> Get(string regionName, UUID scopeID) | 70 | public List<RegionData> Get(string regionName, UUID scopeID) |
57 | { | 71 | { |
58 | if (Instance != this) | 72 | if (m_useStaticInstance && Instance != this) |
59 | return Instance.Get(regionName, scopeID); | 73 | return Instance.Get(regionName, scopeID); |
60 | 74 | ||
75 | // m_log.DebugFormat("[NULL REGION DATA]: Getting region {0}, scope {1}", regionName, scopeID); | ||
76 | |||
61 | string cleanName = regionName.ToLower(); | 77 | string cleanName = regionName.ToLower(); |
62 | 78 | ||
63 | // Handle SQL wildcards | 79 | // Handle SQL wildcards |
@@ -82,6 +98,7 @@ namespace OpenSim.Data.Null | |||
82 | cleanName = cleanName.Remove(cleanName.Length - 1); | 98 | cleanName = cleanName.Remove(cleanName.Length - 1); |
83 | } | 99 | } |
84 | } | 100 | } |
101 | |||
85 | Matcher queryMatch; | 102 | Matcher queryMatch; |
86 | if (wildcardPrefix && wildcardSuffix) | 103 | if (wildcardPrefix && wildcardSuffix) |
87 | queryMatch = delegate(string s) { return s.Contains(cleanName); }; | 104 | queryMatch = delegate(string s) { return s.Contains(cleanName); }; |
@@ -110,7 +127,7 @@ namespace OpenSim.Data.Null | |||
110 | 127 | ||
111 | public RegionData Get(int posX, int posY, UUID scopeID) | 128 | public RegionData Get(int posX, int posY, UUID scopeID) |
112 | { | 129 | { |
113 | if (Instance != this) | 130 | if (m_useStaticInstance && Instance != this) |
114 | return Instance.Get(posX, posY, scopeID); | 131 | return Instance.Get(posX, posY, scopeID); |
115 | 132 | ||
116 | List<RegionData> ret = new List<RegionData>(); | 133 | List<RegionData> ret = new List<RegionData>(); |
@@ -129,7 +146,7 @@ namespace OpenSim.Data.Null | |||
129 | 146 | ||
130 | public RegionData Get(UUID regionID, UUID scopeID) | 147 | public RegionData Get(UUID regionID, UUID scopeID) |
131 | { | 148 | { |
132 | if (Instance != this) | 149 | if (m_useStaticInstance && Instance != this) |
133 | return Instance.Get(regionID, scopeID); | 150 | return Instance.Get(regionID, scopeID); |
134 | 151 | ||
135 | if (m_regionData.ContainsKey(regionID)) | 152 | if (m_regionData.ContainsKey(regionID)) |
@@ -140,7 +157,7 @@ namespace OpenSim.Data.Null | |||
140 | 157 | ||
141 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) | 158 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) |
142 | { | 159 | { |
143 | if (Instance != this) | 160 | if (m_useStaticInstance && Instance != this) |
144 | return Instance.Get(startX, startY, endX, endY, scopeID); | 161 | return Instance.Get(startX, startY, endX, endY, scopeID); |
145 | 162 | ||
146 | List<RegionData> ret = new List<RegionData>(); | 163 | List<RegionData> ret = new List<RegionData>(); |
@@ -156,9 +173,12 @@ namespace OpenSim.Data.Null | |||
156 | 173 | ||
157 | public bool Store(RegionData data) | 174 | public bool Store(RegionData data) |
158 | { | 175 | { |
159 | if (Instance != this) | 176 | if (m_useStaticInstance && Instance != this) |
160 | return Instance.Store(data); | 177 | return Instance.Store(data); |
161 | 178 | ||
179 | // m_log.DebugFormat( | ||
180 | // "[NULL REGION DATA]: Storing region {0} {1}, scope {2}", data.RegionName, data.RegionID, data.ScopeID); | ||
181 | |||
162 | m_regionData[data.RegionID] = data; | 182 | m_regionData[data.RegionID] = data; |
163 | 183 | ||
164 | return true; | 184 | return true; |
@@ -166,7 +186,7 @@ namespace OpenSim.Data.Null | |||
166 | 186 | ||
167 | public bool SetDataItem(UUID regionID, string item, string value) | 187 | public bool SetDataItem(UUID regionID, string item, string value) |
168 | { | 188 | { |
169 | if (Instance != this) | 189 | if (m_useStaticInstance && Instance != this) |
170 | return Instance.SetDataItem(regionID, item, value); | 190 | return Instance.SetDataItem(regionID, item, value); |
171 | 191 | ||
172 | if (!m_regionData.ContainsKey(regionID)) | 192 | if (!m_regionData.ContainsKey(regionID)) |
@@ -179,9 +199,11 @@ namespace OpenSim.Data.Null | |||
179 | 199 | ||
180 | public bool Delete(UUID regionID) | 200 | public bool Delete(UUID regionID) |
181 | { | 201 | { |
182 | if (Instance != this) | 202 | if (m_useStaticInstance && Instance != this) |
183 | return Instance.Delete(regionID); | 203 | return Instance.Delete(regionID); |
184 | 204 | ||
205 | // m_log.DebugFormat("[NULL REGION DATA]: Deleting region {0}", regionID); | ||
206 | |||
185 | if (!m_regionData.ContainsKey(regionID)) | 207 | if (!m_regionData.ContainsKey(regionID)) |
186 | return false; | 208 | return false; |
187 | 209 | ||
diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs index 1ce8c34..b6e48b4 100644 --- a/OpenSim/Framework/AgentCircuitManager.cs +++ b/OpenSim/Framework/AgentCircuitManager.cs | |||
@@ -35,22 +35,36 @@ namespace OpenSim.Framework | |||
35 | /// </summary> | 35 | /// </summary> |
36 | public class AgentCircuitManager | 36 | public class AgentCircuitManager |
37 | { | 37 | { |
38 | public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); | 38 | /// <summary> |
39 | public Dictionary<UUID, AgentCircuitData> AgentCircuitsByUUID = new Dictionary<UUID, AgentCircuitData>(); | 39 | /// Agent circuits indexed by circuit code. |
40 | /// </summary> | ||
41 | /// <remarks> | ||
42 | /// We lock this for operations both on this dictionary and on m_agentCircuitsByUUID | ||
43 | /// </remarks> | ||
44 | private Dictionary<uint, AgentCircuitData> m_agentCircuits = new Dictionary<uint, AgentCircuitData>(); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Agent circuits indexed by agent UUID. | ||
48 | /// </summary> | ||
49 | private Dictionary<UUID, AgentCircuitData> m_agentCircuitsByUUID = new Dictionary<UUID, AgentCircuitData>(); | ||
40 | 50 | ||
41 | public virtual AuthenticateResponse AuthenticateSession(UUID sessionID, UUID agentID, uint circuitcode) | 51 | public virtual AuthenticateResponse AuthenticateSession(UUID sessionID, UUID agentID, uint circuitcode) |
42 | { | 52 | { |
43 | AgentCircuitData validcircuit = null; | 53 | AgentCircuitData validcircuit = null; |
44 | if (AgentCircuits.ContainsKey(circuitcode)) | 54 | |
55 | lock (m_agentCircuits) | ||
45 | { | 56 | { |
46 | validcircuit = AgentCircuits[circuitcode]; | 57 | if (m_agentCircuits.ContainsKey(circuitcode)) |
58 | validcircuit = m_agentCircuits[circuitcode]; | ||
47 | } | 59 | } |
60 | |||
48 | AuthenticateResponse user = new AuthenticateResponse(); | 61 | AuthenticateResponse user = new AuthenticateResponse(); |
62 | |||
49 | if (validcircuit == null) | 63 | if (validcircuit == null) |
50 | { | 64 | { |
51 | //don't have this circuit code in our list | 65 | //don't have this circuit code in our list |
52 | user.Authorised = false; | 66 | user.Authorised = false; |
53 | return (user); | 67 | return user; |
54 | } | 68 | } |
55 | 69 | ||
56 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) | 70 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) |
@@ -72,7 +86,7 @@ namespace OpenSim.Framework | |||
72 | user.Authorised = false; | 86 | user.Authorised = false; |
73 | } | 87 | } |
74 | 88 | ||
75 | return (user); | 89 | return user; |
76 | } | 90 | } |
77 | 91 | ||
78 | /// <summary> | 92 | /// <summary> |
@@ -82,73 +96,93 @@ namespace OpenSim.Framework | |||
82 | /// <param name="agentData"></param> | 96 | /// <param name="agentData"></param> |
83 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) | 97 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) |
84 | { | 98 | { |
85 | lock (AgentCircuits) | 99 | lock (m_agentCircuits) |
86 | { | 100 | { |
87 | if (AgentCircuits.ContainsKey(circuitCode)) | 101 | if (m_agentCircuits.ContainsKey(circuitCode)) |
88 | { | 102 | { |
89 | AgentCircuits[circuitCode] = agentData; | 103 | m_agentCircuits[circuitCode] = agentData; |
90 | AgentCircuitsByUUID[agentData.AgentID] = agentData; | 104 | m_agentCircuitsByUUID[agentData.AgentID] = agentData; |
91 | } | 105 | } |
92 | else | 106 | else |
93 | { | 107 | { |
94 | AgentCircuits.Add(circuitCode, agentData); | 108 | m_agentCircuits.Add(circuitCode, agentData); |
95 | AgentCircuitsByUUID[agentData.AgentID] = agentData; | 109 | m_agentCircuitsByUUID[agentData.AgentID] = agentData; |
96 | } | 110 | } |
97 | } | 111 | } |
98 | } | 112 | } |
99 | 113 | ||
100 | public virtual void RemoveCircuit(uint circuitCode) | 114 | public virtual void RemoveCircuit(uint circuitCode) |
101 | { | 115 | { |
102 | lock (AgentCircuits) | 116 | lock (m_agentCircuits) |
103 | { | 117 | { |
104 | if (AgentCircuits.ContainsKey(circuitCode)) | 118 | if (m_agentCircuits.ContainsKey(circuitCode)) |
105 | { | 119 | { |
106 | UUID agentID = AgentCircuits[circuitCode].AgentID; | 120 | UUID agentID = m_agentCircuits[circuitCode].AgentID; |
107 | AgentCircuits.Remove(circuitCode); | 121 | m_agentCircuits.Remove(circuitCode); |
108 | AgentCircuitsByUUID.Remove(agentID); | 122 | m_agentCircuitsByUUID.Remove(agentID); |
109 | } | 123 | } |
110 | } | 124 | } |
111 | } | 125 | } |
112 | 126 | ||
113 | public virtual void RemoveCircuit(UUID agentID) | 127 | public virtual void RemoveCircuit(UUID agentID) |
114 | { | 128 | { |
115 | lock (AgentCircuits) | 129 | lock (m_agentCircuits) |
116 | { | 130 | { |
117 | if (AgentCircuitsByUUID.ContainsKey(agentID)) | 131 | if (m_agentCircuitsByUUID.ContainsKey(agentID)) |
118 | { | 132 | { |
119 | uint circuitCode = AgentCircuitsByUUID[agentID].circuitcode; | 133 | uint circuitCode = m_agentCircuitsByUUID[agentID].circuitcode; |
120 | AgentCircuits.Remove(circuitCode); | 134 | m_agentCircuits.Remove(circuitCode); |
121 | AgentCircuitsByUUID.Remove(agentID); | 135 | m_agentCircuitsByUUID.Remove(agentID); |
122 | } | 136 | } |
123 | } | 137 | } |
124 | } | 138 | } |
139 | |||
125 | public AgentCircuitData GetAgentCircuitData(uint circuitCode) | 140 | public AgentCircuitData GetAgentCircuitData(uint circuitCode) |
126 | { | 141 | { |
127 | AgentCircuitData agentCircuit = null; | 142 | AgentCircuitData agentCircuit = null; |
128 | AgentCircuits.TryGetValue(circuitCode, out agentCircuit); | 143 | |
144 | lock (m_agentCircuits) | ||
145 | m_agentCircuits.TryGetValue(circuitCode, out agentCircuit); | ||
146 | |||
129 | return agentCircuit; | 147 | return agentCircuit; |
130 | } | 148 | } |
131 | 149 | ||
132 | public AgentCircuitData GetAgentCircuitData(UUID agentID) | 150 | public AgentCircuitData GetAgentCircuitData(UUID agentID) |
133 | { | 151 | { |
134 | AgentCircuitData agentCircuit = null; | 152 | AgentCircuitData agentCircuit = null; |
135 | AgentCircuitsByUUID.TryGetValue(agentID, out agentCircuit); | 153 | |
154 | lock (m_agentCircuits) | ||
155 | m_agentCircuitsByUUID.TryGetValue(agentID, out agentCircuit); | ||
156 | |||
136 | return agentCircuit; | 157 | return agentCircuit; |
137 | } | 158 | } |
138 | 159 | ||
160 | /// <summary> | ||
161 | /// Get all current agent circuits indexed by agent UUID. | ||
162 | /// </summary> | ||
163 | /// <returns></returns> | ||
164 | public Dictionary<UUID, AgentCircuitData> GetAgentCircuits() | ||
165 | { | ||
166 | lock (m_agentCircuits) | ||
167 | return new Dictionary<UUID, AgentCircuitData>(m_agentCircuitsByUUID); | ||
168 | } | ||
169 | |||
139 | public void UpdateAgentData(AgentCircuitData agentData) | 170 | public void UpdateAgentData(AgentCircuitData agentData) |
140 | { | 171 | { |
141 | if (AgentCircuits.ContainsKey((uint) agentData.circuitcode)) | 172 | lock (m_agentCircuits) |
142 | { | 173 | { |
143 | AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; | 174 | if (m_agentCircuits.ContainsKey((uint) agentData.circuitcode)) |
144 | AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; | 175 | { |
145 | AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; | 176 | m_agentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; |
177 | m_agentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; | ||
178 | m_agentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; | ||
146 | 179 | ||
147 | // Updated for when we don't know them before calling Scene.NewUserConnection | 180 | // Updated for when we don't know them before calling Scene.NewUserConnection |
148 | AgentCircuits[(uint) agentData.circuitcode].SecureSessionID = agentData.SecureSessionID; | 181 | m_agentCircuits[(uint) agentData.circuitcode].SecureSessionID = agentData.SecureSessionID; |
149 | AgentCircuits[(uint) agentData.circuitcode].SessionID = agentData.SessionID; | 182 | m_agentCircuits[(uint) agentData.circuitcode].SessionID = agentData.SessionID; |
150 | 183 | ||
151 | // m_log.Debug("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); | 184 | // m_log.Debug("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); |
185 | } | ||
152 | } | 186 | } |
153 | } | 187 | } |
154 | 188 | ||
@@ -159,38 +193,37 @@ namespace OpenSim.Framework | |||
159 | /// <param name="newcircuitcode"></param> | 193 | /// <param name="newcircuitcode"></param> |
160 | public bool TryChangeCiruitCode(uint circuitcode, uint newcircuitcode) | 194 | public bool TryChangeCiruitCode(uint circuitcode, uint newcircuitcode) |
161 | { | 195 | { |
162 | lock (AgentCircuits) | 196 | lock (m_agentCircuits) |
163 | { | 197 | { |
164 | if (AgentCircuits.ContainsKey((uint)circuitcode) && !AgentCircuits.ContainsKey((uint)newcircuitcode)) | 198 | if (m_agentCircuits.ContainsKey((uint)circuitcode) && !m_agentCircuits.ContainsKey((uint)newcircuitcode)) |
165 | { | 199 | { |
166 | AgentCircuitData agentData = AgentCircuits[(uint)circuitcode]; | 200 | AgentCircuitData agentData = m_agentCircuits[(uint)circuitcode]; |
167 | 201 | ||
168 | agentData.circuitcode = newcircuitcode; | 202 | agentData.circuitcode = newcircuitcode; |
169 | 203 | ||
170 | AgentCircuits.Remove((uint)circuitcode); | 204 | m_agentCircuits.Remove((uint)circuitcode); |
171 | AgentCircuits.Add(newcircuitcode, agentData); | 205 | m_agentCircuits.Add(newcircuitcode, agentData); |
172 | return true; | 206 | return true; |
173 | } | 207 | } |
174 | } | 208 | } |
175 | return false; | ||
176 | 209 | ||
210 | return false; | ||
177 | } | 211 | } |
178 | 212 | ||
179 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) | 213 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) |
180 | { | 214 | { |
181 | if (AgentCircuits.ContainsKey(circuitcode)) | 215 | lock (m_agentCircuits) |
182 | { | 216 | if (m_agentCircuits.ContainsKey(circuitcode)) |
183 | AgentCircuits[circuitcode].child = childstatus; | 217 | m_agentCircuits[circuitcode].child = childstatus; |
184 | } | ||
185 | } | 218 | } |
186 | 219 | ||
187 | public bool GetAgentChildStatus(uint circuitcode) | 220 | public bool GetAgentChildStatus(uint circuitcode) |
188 | { | 221 | { |
189 | if (AgentCircuits.ContainsKey(circuitcode)) | 222 | lock (m_agentCircuits) |
190 | { | 223 | if (m_agentCircuits.ContainsKey(circuitcode)) |
191 | return AgentCircuits[circuitcode].child; | 224 | return m_agentCircuits[circuitcode].child; |
192 | } | 225 | |
193 | return false; | 226 | return false; |
194 | } | 227 | } |
195 | } | 228 | } |
196 | } | 229 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs index 9615f1b..ae132c8 100644 --- a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs +++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs | |||
@@ -194,8 +194,6 @@ namespace OpenSim.Framework.Tests | |||
194 | 194 | ||
195 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); | 195 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); |
196 | Assert.That(!resp.Authorised); | 196 | Assert.That(!resp.Authorised); |
197 | |||
198 | } | 197 | } |
199 | |||
200 | } | 198 | } |
201 | } | 199 | } |
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs index aa4c6aa..967a355 100644 --- a/OpenSim/Framework/Tests/AnimationTests.cs +++ b/OpenSim/Framework/Tests/AnimationTests.cs | |||
@@ -87,8 +87,6 @@ namespace OpenSim.Framework.Tests | |||
87 | anim4.SequenceNum = anim2.SequenceNum; | 87 | anim4.SequenceNum = anim2.SequenceNum; |
88 | 88 | ||
89 | Assert.That(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly."); | 89 | Assert.That(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly."); |
90 | |||
91 | |||
92 | } | 90 | } |
93 | } | 91 | } |
94 | } \ No newline at end of file | 92 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index b4dbeae..df4dbee 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -1039,7 +1039,7 @@ namespace OpenSim | |||
1039 | { | 1039 | { |
1040 | //this.HttpServer. | 1040 | //this.HttpServer. |
1041 | acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); | 1041 | acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); |
1042 | foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.AgentCircuits.Values) | 1042 | foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values) |
1043 | acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); | 1043 | acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); |
1044 | } | 1044 | } |
1045 | ); | 1045 | ); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 07b4df3..98dda36 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -56,8 +56,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
56 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, | 56 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, |
57 | byte[] data, string inventoryType, string assetType); | 57 | byte[] data, string inventoryType, string assetType); |
58 | 58 | ||
59 | public delegate void UploadedBakedTexture(UUID assetID, byte[] data); | ||
60 | |||
61 | public delegate UUID UpdateItem(UUID itemID, byte[] data); | 59 | public delegate UUID UpdateItem(UUID itemID, byte[] data); |
62 | 60 | ||
63 | public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); | 61 | public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); |
@@ -97,7 +95,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
97 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | 95 | private static readonly string m_notecardTaskUpdatePath = "0005/"; |
98 | // private static readonly string m_fetchInventoryPath = "0006/"; | 96 | // private static readonly string m_fetchInventoryPath = "0006/"; |
99 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | 97 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. |
100 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. | ||
101 | 98 | ||
102 | 99 | ||
103 | // These are callbacks which will be setup by the scene so that we can update scene data when we | 100 | // These are callbacks which will be setup by the scene so that we can update scene data when we |
@@ -164,8 +161,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
164 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); | 161 | IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); |
165 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); | 162 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); |
166 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); | 163 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); |
167 | m_HostCapsObj.RegisterHandler("UploadBakedTexture", new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture)); | ||
168 | |||
169 | } | 164 | } |
170 | catch (Exception e) | 165 | catch (Exception e) |
171 | { | 166 | { |
@@ -331,74 +326,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
331 | } | 326 | } |
332 | 327 | ||
333 | /// <summary> | 328 | /// <summary> |
334 | /// Handle a request from the client for a Uri to upload a baked texture. | ||
335 | /// </summary> | ||
336 | /// <param name="request"></param> | ||
337 | /// <param name="path"></param> | ||
338 | /// <param name="param"></param> | ||
339 | /// <param name="httpRequest"></param> | ||
340 | /// <param name="httpResponse"></param> | ||
341 | /// <returns>The upload response if the request is successful, null otherwise.</returns> | ||
342 | public string UploadBakedTexture(string request, string path, | ||
343 | string param, OSHttpRequest httpRequest, | ||
344 | OSHttpResponse httpResponse) | ||
345 | { | ||
346 | try | ||
347 | { | ||
348 | // m_log.Debug("[CAPS]: UploadBakedTexture Request in region: " + m_regionName); | ||
349 | |||
350 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | ||
351 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
352 | |||
353 | BakedTextureUploader uploader = | ||
354 | new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener); | ||
355 | uploader.OnUpLoad += BakedTextureUploaded; | ||
356 | |||
357 | m_HostCapsObj.HttpListener.AddStreamHandler( | ||
358 | new BinaryStreamHandler("POST", capsBase + uploaderPath, | ||
359 | uploader.uploaderCaps)); | ||
360 | |||
361 | string protocol = "http://"; | ||
362 | |||
363 | if (m_HostCapsObj.SSLCaps) | ||
364 | protocol = "https://"; | ||
365 | |||
366 | string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + | ||
367 | m_HostCapsObj.Port.ToString() + capsBase + uploaderPath; | ||
368 | |||
369 | LLSDAssetUploadResponse uploadResponse = | ||
370 | new LLSDAssetUploadResponse(); | ||
371 | uploadResponse.uploader = uploaderURL; | ||
372 | uploadResponse.state = "upload"; | ||
373 | |||
374 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
375 | } | ||
376 | catch (Exception e) | ||
377 | { | ||
378 | m_log.Error("[CAPS]: " + e.ToString()); | ||
379 | } | ||
380 | |||
381 | return null; | ||
382 | } | ||
383 | |||
384 | /// <summary> | ||
385 | /// Called when a baked texture has been successfully uploaded by a client. | ||
386 | /// </summary> | ||
387 | /// <param name="assetID"></param> | ||
388 | /// <param name="data"></param> | ||
389 | public void BakedTextureUploaded(UUID assetID, byte[] data) | ||
390 | { | ||
391 | // m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | ||
392 | |||
393 | AssetBase asset; | ||
394 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); | ||
395 | asset.Data = data; | ||
396 | asset.Temporary = true; | ||
397 | asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are | ||
398 | m_assetService.Store(asset); | ||
399 | } | ||
400 | |||
401 | /// <summary> | ||
402 | /// Called when new asset data for an agent inventory item update has been uploaded. | 329 | /// Called when new asset data for an agent inventory item update has been uploaded. |
403 | /// </summary> | 330 | /// </summary> |
404 | /// <param name="itemID">Item to update</param> | 331 | /// <param name="itemID">Item to update</param> |
@@ -1067,6 +994,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1067 | // XXX Maybe this should be some meaningful error packet | 994 | // XXX Maybe this should be some meaningful error packet |
1068 | return null; | 995 | return null; |
1069 | } | 996 | } |
997 | |||
1070 | ///Left this in and commented in case there are unforseen issues | 998 | ///Left this in and commented in case there are unforseen issues |
1071 | //private void SaveAssetToFile(string filename, byte[] data) | 999 | //private void SaveAssetToFile(string filename, byte[] data) |
1072 | //{ | 1000 | //{ |
@@ -1090,53 +1018,4 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1090 | fs.Close(); | 1018 | fs.Close(); |
1091 | } | 1019 | } |
1092 | } | 1020 | } |
1093 | |||
1094 | public class BakedTextureUploader | ||
1095 | { | ||
1096 | public event UploadedBakedTexture OnUpLoad; | ||
1097 | private UploadedBakedTexture handlerUpLoad = null; | ||
1098 | |||
1099 | private string uploaderPath = String.Empty; | ||
1100 | private UUID newAssetID; | ||
1101 | private IHttpServer httpListener; | ||
1102 | |||
1103 | public BakedTextureUploader(string path, IHttpServer httpServer) | ||
1104 | { | ||
1105 | newAssetID = UUID.Random(); | ||
1106 | uploaderPath = path; | ||
1107 | httpListener = httpServer; | ||
1108 | // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); | ||
1109 | } | ||
1110 | |||
1111 | /// <summary> | ||
1112 | /// Handle raw uploaded baked texture data. | ||
1113 | /// </summary> | ||
1114 | /// <param name="data"></param> | ||
1115 | /// <param name="path"></param> | ||
1116 | /// <param name="param"></param> | ||
1117 | /// <returns></returns> | ||
1118 | public string uploaderCaps(byte[] data, string path, string param) | ||
1119 | { | ||
1120 | handlerUpLoad = OnUpLoad; | ||
1121 | if (handlerUpLoad != null) | ||
1122 | { | ||
1123 | Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); }); | ||
1124 | } | ||
1125 | |||
1126 | string res = String.Empty; | ||
1127 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | ||
1128 | uploadComplete.new_asset = newAssetID.ToString(); | ||
1129 | uploadComplete.new_inventory_item = UUID.Zero; | ||
1130 | uploadComplete.state = "complete"; | ||
1131 | |||
1132 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
1133 | |||
1134 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
1135 | |||
1136 | // m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); | ||
1137 | |||
1138 | return res; | ||
1139 | } | ||
1140 | } | ||
1141 | |||
1142 | } \ No newline at end of file | 1021 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs new file mode 100644 index 0000000..e61815f --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -0,0 +1,112 @@ | |||
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 System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Specialized; | ||
31 | using System.Drawing; | ||
32 | using System.Drawing.Imaging; | ||
33 | using System.Reflection; | ||
34 | using System.IO; | ||
35 | using System.Web; | ||
36 | using log4net; | ||
37 | using Nini.Config; | ||
38 | using Mono.Addins; | ||
39 | using OpenMetaverse; | ||
40 | using OpenMetaverse.StructuredData; | ||
41 | using OpenMetaverse.Imaging; | ||
42 | using OpenSim.Framework; | ||
43 | using OpenSim.Framework.Servers; | ||
44 | using OpenSim.Framework.Servers.HttpServer; | ||
45 | using OpenSim.Region.Framework.Interfaces; | ||
46 | using OpenSim.Region.Framework.Scenes; | ||
47 | using OpenSim.Services.Interfaces; | ||
48 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
49 | using OpenSim.Capabilities.Handlers; | ||
50 | |||
51 | namespace OpenSim.Region.ClientStack.Linden | ||
52 | { | ||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
54 | public class UploadBakedTextureModule : INonSharedRegionModule | ||
55 | { | ||
56 | // private static readonly ILog m_log = | ||
57 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
58 | |||
59 | /// <summary> | ||
60 | /// For historical reasons this is fixed, but there | ||
61 | /// </summary> | ||
62 | private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. | ||
63 | |||
64 | private Scene m_scene; | ||
65 | private bool m_persistBakedTextures; | ||
66 | |||
67 | public void Initialise(IConfigSource source) | ||
68 | { | ||
69 | IConfig sconfig = source.Configs["Startup"]; | ||
70 | if (sconfig != null) | ||
71 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | ||
72 | } | ||
73 | |||
74 | public void AddRegion(Scene s) | ||
75 | { | ||
76 | m_scene = s; | ||
77 | } | ||
78 | |||
79 | public void RemoveRegion(Scene s) | ||
80 | { | ||
81 | } | ||
82 | |||
83 | public void RegionLoaded(Scene s) | ||
84 | { | ||
85 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
86 | } | ||
87 | |||
88 | public void PostInitialise() | ||
89 | { | ||
90 | } | ||
91 | |||
92 | public void Close() { } | ||
93 | |||
94 | public string Name { get { return "UploadBakedTextureModule"; } } | ||
95 | |||
96 | public Type ReplaceableInterface | ||
97 | { | ||
98 | get { return null; } | ||
99 | } | ||
100 | |||
101 | public void RegisterCaps(UUID agentID, Caps caps) | ||
102 | { | ||
103 | caps.RegisterHandler( | ||
104 | "UploadBakedTexture", | ||
105 | new RestStreamHandler( | ||
106 | "POST", | ||
107 | "/CAPS/" + m_uploadBakedTexturePath, | ||
108 | new UploadBakedTextureHandler( | ||
109 | caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture)); | ||
110 | } | ||
111 | } | ||
112 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 5431841..9875f56 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -496,7 +496,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
496 | // Well, this is it. The agent is over there. | 496 | // Well, this is it. The agent is over there. |
497 | KillEntity(sp.Scene, sp.LocalId); | 497 | KillEntity(sp.Scene, sp.LocalId); |
498 | 498 | ||
499 | |||
500 | // Now let's make it officially a child agent | 499 | // Now let's make it officially a child agent |
501 | sp.MakeChildAgent(); | 500 | sp.MakeChildAgent(); |
502 | 501 | ||
@@ -511,9 +510,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
511 | sp.Scene.IncomingCloseAgent(sp.UUID); | 510 | sp.Scene.IncomingCloseAgent(sp.UUID); |
512 | } | 511 | } |
513 | else | 512 | else |
513 | { | ||
514 | // now we have a child agent in this region. | 514 | // now we have a child agent in this region. |
515 | sp.Reset(); | 515 | sp.Reset(); |
516 | 516 | } | |
517 | 517 | ||
518 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 518 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! |
519 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | 519 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) |
@@ -965,115 +965,121 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
965 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, | 965 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, |
966 | bool isFlying, string version) | 966 | bool isFlying, string version) |
967 | { | 967 | { |
968 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 968 | try |
969 | |||
970 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version); | ||
971 | |||
972 | Scene m_scene = agent.Scene; | ||
973 | |||
974 | if (neighbourRegion != null) | ||
975 | { | 969 | { |
976 | if (!agent.ValidateAttachments()) | 970 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
977 | m_log.DebugFormat( | 971 | |
978 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | 972 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version); |
979 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | 973 | |
980 | 974 | Scene m_scene = agent.Scene; | |
981 | pos = pos + (agent.Velocity); | 975 | |
982 | 976 | if (neighbourRegion != null) | |
983 | SetInTransit(agent.UUID); | ||
984 | AgentData cAgent = new AgentData(); | ||
985 | agent.CopyTo(cAgent); | ||
986 | cAgent.Position = pos; | ||
987 | if (isFlying) | ||
988 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
989 | cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + | ||
990 | "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | ||
991 | |||
992 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | ||
993 | { | ||
994 | // region doesn't take it | ||
995 | ReInstantiateScripts(agent); | ||
996 | ResetFromTransit(agent.UUID); | ||
997 | return agent; | ||
998 | } | ||
999 | |||
1000 | // Next, let's close the child agent connections that are too far away. | ||
1001 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1002 | |||
1003 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | ||
1004 | agent.ControllingClient.RequestClientInfo(); | ||
1005 | |||
1006 | //m_log.Debug("BEFORE CROSS"); | ||
1007 | //Scene.DumpChildrenSeeds(UUID); | ||
1008 | //DumpKnownRegions(); | ||
1009 | string agentcaps; | ||
1010 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1011 | { | ||
1012 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1013 | neighbourRegion.RegionHandle); | ||
1014 | return agent; | ||
1015 | } | ||
1016 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | ||
1017 | |||
1018 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | ||
1019 | |||
1020 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | ||
1021 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; | ||
1022 | if (neighbourExternal != null) | ||
1023 | { | 977 | { |
978 | if (!agent.ValidateAttachments()) | ||
979 | m_log.DebugFormat( | ||
980 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | ||
981 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | ||
982 | |||
983 | pos = pos + (agent.Velocity); | ||
984 | |||
985 | SetInTransit(agent.UUID); | ||
986 | AgentData cAgent = new AgentData(); | ||
987 | agent.CopyTo(cAgent); | ||
988 | cAgent.Position = pos; | ||
989 | if (isFlying) | ||
990 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
991 | cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + | ||
992 | "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | ||
993 | |||
994 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | ||
995 | { | ||
996 | // region doesn't take it | ||
997 | ReInstantiateScripts(agent); | ||
998 | ResetFromTransit(agent.UUID); | ||
999 | return agent; | ||
1000 | } | ||
1001 | |||
1002 | // Next, let's close the child agent connections that are too far away. | ||
1003 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1004 | |||
1005 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | ||
1006 | agent.ControllingClient.RequestClientInfo(); | ||
1007 | |||
1008 | //m_log.Debug("BEFORE CROSS"); | ||
1009 | //Scene.DumpChildrenSeeds(UUID); | ||
1010 | //DumpKnownRegions(); | ||
1011 | string agentcaps; | ||
1012 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1013 | { | ||
1014 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1015 | neighbourRegion.RegionHandle); | ||
1016 | return agent; | ||
1017 | } | ||
1018 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | ||
1019 | |||
1020 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | ||
1021 | |||
1022 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | ||
1024 | if (eq != null) | 1023 | if (eq != null) |
1025 | { | 1024 | { |
1026 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | 1025 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, |
1027 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | 1026 | capsPath, agent.UUID, agent.ControllingClient.SessionId); |
1028 | } | 1027 | } |
1029 | else | 1028 | else |
1030 | { | 1029 | { |
1031 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | 1030 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, |
1032 | capsPath); | 1031 | capsPath); |
1033 | } | 1032 | } |
1033 | |||
1034 | if (!WaitForCallback(agent.UUID)) | ||
1035 | { | ||
1036 | m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); | ||
1037 | ReInstantiateScripts(agent); | ||
1038 | ResetFromTransit(agent.UUID); | ||
1039 | |||
1040 | // Yikes! We should just have a ref to scene here. | ||
1041 | //agent.Scene.InformClientOfNeighbours(agent); | ||
1042 | EnableChildAgents(agent); | ||
1043 | |||
1044 | return agent; | ||
1045 | } | ||
1046 | |||
1047 | agent.MakeChildAgent(); | ||
1048 | |||
1049 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
1050 | agent.SendOtherAgentsAvatarDataToMe(); | ||
1051 | agent.SendOtherAgentsAppearanceToMe(); | ||
1052 | |||
1053 | // Backwards compatibility | ||
1054 | if (version == "Unknown" || version == string.Empty) | ||
1055 | { | ||
1056 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one..."); | ||
1057 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1058 | } | ||
1059 | |||
1060 | AgentHasMovedAway(agent, false); | ||
1061 | |||
1062 | // the user may change their profile information in other region, | ||
1063 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1064 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1065 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1066 | { | ||
1067 | m_log.DebugFormat( | ||
1068 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1069 | } | ||
1034 | } | 1070 | } |
1035 | 1071 | ||
1036 | if (!WaitForCallback(agent.UUID)) | 1072 | //m_log.Debug("AFTER CROSS"); |
1037 | { | 1073 | //Scene.DumpChildrenSeeds(UUID); |
1038 | m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); | 1074 | //DumpKnownRegions(); |
1039 | ReInstantiateScripts(agent); | 1075 | } |
1040 | ResetFromTransit(agent.UUID); | 1076 | catch (Exception e) |
1041 | 1077 | { | |
1042 | // Yikes! We should just have a ref to scene here. | 1078 | m_log.ErrorFormat( |
1043 | //agent.Scene.InformClientOfNeighbours(agent); | 1079 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", |
1044 | EnableChildAgents(agent); | 1080 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); |
1045 | |||
1046 | return agent; | ||
1047 | } | ||
1048 | |||
1049 | agent.MakeChildAgent(); | ||
1050 | |||
1051 | // now we have a child agent in this region. Request all interesting data about other (root) agents | ||
1052 | agent.SendOtherAgentsAvatarDataToMe(); | ||
1053 | agent.SendOtherAgentsAppearanceToMe(); | ||
1054 | |||
1055 | // Backwards compatibility | ||
1056 | if (version == "Unknown" || version == string.Empty) | ||
1057 | { | ||
1058 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one..."); | ||
1059 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1060 | } | ||
1061 | |||
1062 | AgentHasMovedAway(agent, false); | ||
1063 | |||
1064 | // the user may change their profile information in other region, | ||
1065 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1066 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1067 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1068 | { | ||
1069 | m_log.DebugFormat( | ||
1070 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1071 | } | ||
1072 | } | 1081 | } |
1073 | 1082 | ||
1074 | //m_log.Debug("AFTER CROSS"); | ||
1075 | //Scene.DumpChildrenSeeds(UUID); | ||
1076 | //DumpKnownRegions(); | ||
1077 | return agent; | 1083 | return agent; |
1078 | } | 1084 | } |
1079 | 1085 | ||
@@ -1359,7 +1365,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1359 | 1365 | ||
1360 | string reason = String.Empty; | 1366 | string reason = String.Empty; |
1361 | 1367 | ||
1362 | |||
1363 | bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); | 1368 | bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); |
1364 | 1369 | ||
1365 | if (regionAccepted && newAgent) | 1370 | if (regionAccepted && newAgent) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index cd7d6bc..b286d17 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | |||
@@ -31,11 +31,10 @@ using System.IO; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using log4net.Config; | 33 | using log4net.Config; |
34 | using Nini.Config; | ||
34 | using NUnit.Framework; | 35 | using NUnit.Framework; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using Nini.Config; | ||
38 | |||
39 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; | 38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; |
40 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
@@ -69,6 +68,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
69 | [Test] | 68 | [Test] |
70 | public void TestRegisterRegion() | 69 | public void TestRegisterRegion() |
71 | { | 70 | { |
71 | TestHelpers.InMethod(); | ||
72 | // log4net.Config.XmlConfigurator.Configure(); | ||
73 | |||
72 | SetUp(); | 74 | SetUp(); |
73 | 75 | ||
74 | // Create 4 regions | 76 | // Create 4 regions |
@@ -191,7 +193,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests | |||
191 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); | 193 | results = m_LocalConnector.GetHyperlinks(UUID.Zero); |
192 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); | 194 | Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); |
193 | Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected"); | 195 | Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected"); |
194 | |||
195 | } | 196 | } |
196 | } | 197 | } |
197 | } | 198 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 4cf854e..43cfd80 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -54,11 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
54 | /// <value> | 54 | /// <value> |
55 | /// The current movement animation | 55 | /// The current movement animation |
56 | /// </value> | 56 | /// </value> |
57 | public string CurrentMovementAnimation | 57 | public string CurrentMovementAnimation { get; private set; } |
58 | { | 58 | |
59 | get { return m_movementAnimation; } | ||
60 | } | ||
61 | protected string m_movementAnimation = "CROUCH"; | ||
62 | private int m_animTickFall; | 59 | private int m_animTickFall; |
63 | public int m_animTickJump; // ScenePresence has to see this to control +Z force | 60 | public int m_animTickJump; // ScenePresence has to see this to control +Z force |
64 | public bool m_jumping = false; | 61 | public bool m_jumping = false; |
@@ -79,6 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
79 | public ScenePresenceAnimator(ScenePresence sp) | 76 | public ScenePresenceAnimator(ScenePresence sp) |
80 | { | 77 | { |
81 | m_scenePresence = sp; | 78 | m_scenePresence = sp; |
79 | CurrentMovementAnimation = "CROUCH"; | ||
82 | } | 80 | } |
83 | 81 | ||
84 | public void AddAnimation(UUID animID, UUID objectID) | 82 | public void AddAnimation(UUID animID, UUID objectID) |
@@ -131,8 +129,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
131 | 129 | ||
132 | public void ResetAnimations() | 130 | public void ResetAnimations() |
133 | { | 131 | { |
132 | // m_log.DebugFormat( | ||
133 | // "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", | ||
134 | // m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); | ||
135 | |||
134 | m_animations.Clear(); | 136 | m_animations.Clear(); |
135 | TrySetMovementAnimation("STAND"); | ||
136 | } | 137 | } |
137 | 138 | ||
138 | /// <summary> | 139 | /// <summary> |
@@ -143,6 +144,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
143 | { | 144 | { |
144 | if (!m_scenePresence.IsChildAgent) | 145 | if (!m_scenePresence.IsChildAgent) |
145 | { | 146 | { |
147 | // m_log.DebugFormat( | ||
148 | // "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}", | ||
149 | // anim, m_scenePresence.Name); | ||
150 | |||
146 | if (m_animations.TrySetDefaultAnimation( | 151 | if (m_animations.TrySetDefaultAnimation( |
147 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) | 152 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) |
148 | { | 153 | { |
@@ -155,12 +160,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
155 | SendAnimPack(); | 160 | SendAnimPack(); |
156 | } | 161 | } |
157 | } | 162 | } |
163 | else | ||
164 | { | ||
165 | m_log.WarnFormat( | ||
166 | "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", | ||
167 | anim, m_scenePresence.Name); | ||
168 | } | ||
158 | } | 169 | } |
159 | 170 | ||
160 | /// <summary> | 171 | /// <summary> |
161 | /// This method determines the proper movement related animation | 172 | /// This method determines the proper movement related animation |
162 | /// </summary> | 173 | /// </summary> |
163 | public string GetMovementAnimation() | 174 | private string DetermineMovementAnimation() |
164 | { | 175 | { |
165 | const float FALL_DELAY = 800f; | 176 | const float FALL_DELAY = 800f; |
166 | const float PREJUMP_DELAY = 200f; | 177 | const float PREJUMP_DELAY = 200f; |
@@ -263,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
263 | return "FALLDOWN"; | 274 | return "FALLDOWN"; |
264 | } | 275 | } |
265 | 276 | ||
266 | return m_movementAnimation; | 277 | return CurrentMovementAnimation; |
267 | } | 278 | } |
268 | 279 | ||
269 | #endregion Falling/Floating/Landing | 280 | #endregion Falling/Floating/Landing |
@@ -274,7 +285,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
274 | int jumptime; | 285 | int jumptime; |
275 | jumptime = Environment.TickCount - m_animTickJump; | 286 | jumptime = Environment.TickCount - m_animTickJump; |
276 | 287 | ||
277 | |||
278 | if ((move.Z > 0f) && (!m_jumping)) | 288 | if ((move.Z > 0f) && (!m_jumping)) |
279 | { | 289 | { |
280 | // Start jumping, prejump | 290 | // Start jumping, prejump |
@@ -318,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
318 | 328 | ||
319 | #region Ground Movement | 329 | #region Ground Movement |
320 | 330 | ||
321 | if (m_movementAnimation == "FALLDOWN") | 331 | if (CurrentMovementAnimation == "FALLDOWN") |
322 | { | 332 | { |
323 | m_falling = false; | 333 | m_falling = false; |
324 | m_animTickFall = Environment.TickCount; | 334 | m_animTickFall = Environment.TickCount; |
@@ -331,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
331 | else | 341 | else |
332 | return "LAND"; | 342 | return "LAND"; |
333 | } | 343 | } |
334 | else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP")) | 344 | else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP")) |
335 | { | 345 | { |
336 | int landElapsed = Environment.TickCount - m_animTickFall; | 346 | int landElapsed = Environment.TickCount - m_animTickFall; |
337 | int limit = 1000; | 347 | int limit = 1000; |
338 | if(m_movementAnimation == "LAND") limit = 350; | 348 | if (CurrentMovementAnimation == "LAND") |
349 | limit = 350; | ||
339 | // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client | 350 | // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client |
340 | 351 | ||
341 | if ((m_animTickFall != 0) && (landElapsed <= limit)) | 352 | if ((m_animTickFall != 0) && (landElapsed <= limit)) |
342 | { | 353 | { |
343 | return m_movementAnimation; | 354 | return CurrentMovementAnimation; |
344 | } | 355 | } |
345 | else | 356 | else |
346 | { | 357 | { |
@@ -378,7 +389,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
378 | #endregion Ground Movement | 389 | #endregion Ground Movement |
379 | 390 | ||
380 | m_falling = false; | 391 | m_falling = false; |
381 | return m_movementAnimation; | 392 | |
393 | return CurrentMovementAnimation; | ||
382 | } | 394 | } |
383 | 395 | ||
384 | /// <summary> | 396 | /// <summary> |
@@ -386,8 +398,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
386 | /// </summary> | 398 | /// </summary> |
387 | public void UpdateMovementAnimations() | 399 | public void UpdateMovementAnimations() |
388 | { | 400 | { |
389 | m_movementAnimation = GetMovementAnimation(); | 401 | CurrentMovementAnimation = DetermineMovementAnimation(); |
390 | TrySetMovementAnimation(m_movementAnimation); | 402 | |
403 | // m_log.DebugFormat( | ||
404 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", | ||
405 | // CurrentMovementAnimation, m_scenePresence.Name); | ||
406 | |||
407 | TrySetMovementAnimation(CurrentMovementAnimation); | ||
391 | } | 408 | } |
392 | 409 | ||
393 | public UUID[] GetAnimationArray() | 410 | public UUID[] GetAnimationArray() |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c88e1d7..dbf29d0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3326,9 +3326,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3326 | if (hasHollow) ret += 1; | 3326 | if (hasHollow) ret += 1; |
3327 | break; | 3327 | break; |
3328 | case PrimType.SCULPT: | 3328 | case PrimType.SCULPT: |
3329 | ret = 1; | 3329 | // Special mesh handling |
3330 | if (Shape.SculptType == (byte)SculptType.Mesh) | ||
3331 | ret = 8; // if it's a mesh then max 8 faces | ||
3332 | else | ||
3333 | ret = 1; // if it's a sculpt then max 1 face | ||
3330 | break; | 3334 | break; |
3331 | } | 3335 | } |
3336 | |||
3332 | return ret; | 3337 | return ret; |
3333 | } | 3338 | } |
3334 | 3339 | ||
@@ -3341,6 +3346,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3341 | { | 3346 | { |
3342 | if (Shape.SculptEntry) | 3347 | if (Shape.SculptEntry) |
3343 | return PrimType.SCULPT; | 3348 | return PrimType.SCULPT; |
3349 | |||
3344 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | 3350 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) |
3345 | { | 3351 | { |
3346 | if (Shape.PathCurve == (byte)Extrusion.Straight) | 3352 | if (Shape.PathCurve == (byte)Extrusion.Straight) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 21c9402..3c97852 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -149,9 +149,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | } | 149 | } |
150 | private bool m_wasFlying; // add for fly velocity control | 150 | private bool m_wasFlying; // add for fly velocity control |
151 | 151 | ||
152 | private int m_lastColCount = -1; //KF: Look for Collision chnages | 152 | // private int m_lastColCount = -1; //KF: Look for Collision chnages |
153 | private int m_updateCount = 0; //KF: Update Anims for a while | 153 | // private int m_updateCount = 0; //KF: Update Anims for a while |
154 | private static readonly int UPDATE_COUNT = 10; // how many frames to update for | 154 | // private static readonly int UPDATE_COUNT = 10; // how many frames to update for |
155 | private List<uint> m_lastColliders = new List<uint>(); | 155 | private List<uint> m_lastColliders = new List<uint>(); |
156 | 156 | ||
157 | private TeleportFlags m_teleportFlags; | 157 | private TeleportFlags m_teleportFlags; |
@@ -794,9 +794,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | 794 | ||
795 | AdjustKnownSeeds(); | 795 | AdjustKnownSeeds(); |
796 | 796 | ||
797 | // TODO: I think, this won't send anything, as we are still a child here... | ||
798 | Animator.TrySetMovementAnimation("STAND"); | ||
799 | |||
800 | // we created a new ScenePresence (a new child agent) in a fresh region. | 797 | // we created a new ScenePresence (a new child agent) in a fresh region. |
801 | // Request info about all the (root) agents in this region | 798 | // Request info about all the (root) agents in this region |
802 | // Note: This won't send data *to* other clients in that region (children don't send) | 799 | // Note: This won't send data *to* other clients in that region (children don't send) |
@@ -1012,13 +1009,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1012 | 1009 | ||
1013 | /// <summary> | 1010 | /// <summary> |
1014 | /// This turns a root agent into a child agent | 1011 | /// This turns a root agent into a child agent |
1012 | /// </summary> | ||
1013 | /// <remarks> | ||
1015 | /// when an agent departs this region for a neighbor, this gets called. | 1014 | /// when an agent departs this region for a neighbor, this gets called. |
1016 | /// | 1015 | /// |
1017 | /// It doesn't get called for a teleport. Reason being, an agent that | 1016 | /// It doesn't get called for a teleport. Reason being, an agent that |
1018 | /// teleports out may not end up anywhere near this region | 1017 | /// teleports out may not end up anywhere near this region |
1019 | /// </summary> | 1018 | /// </remarks> |
1020 | public void MakeChildAgent() | 1019 | public void MakeChildAgent() |
1021 | { | 1020 | { |
1021 | m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); | ||
1022 | |||
1022 | // Reset these so that teleporting in and walking out isn't seen | 1023 | // Reset these so that teleporting in and walking out isn't seen |
1023 | // as teleporting back | 1024 | // as teleporting back |
1024 | TeleportFlags = TeleportFlags.Default; | 1025 | TeleportFlags = TeleportFlags.Default; |
@@ -1308,11 +1309,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1308 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", | 1309 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", |
1309 | // Scene.RegionInfo.RegionName, remoteClient.Name); | 1310 | // Scene.RegionInfo.RegionName, remoteClient.Name); |
1310 | 1311 | ||
1311 | //if (IsChildAgent) | 1312 | if (IsChildAgent) |
1312 | //{ | 1313 | { |
1313 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1314 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
1314 | // return; | 1315 | return; |
1315 | //} | 1316 | } |
1316 | 1317 | ||
1317 | ++m_movementUpdateCount; | 1318 | ++m_movementUpdateCount; |
1318 | if (m_movementUpdateCount < 1) | 1319 | if (m_movementUpdateCount < 1) |
@@ -1381,14 +1382,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1381 | 1382 | ||
1382 | #endregion Inputs | 1383 | #endregion Inputs |
1383 | 1384 | ||
1384 | // Make anims work for client side autopilot | 1385 | // // Make anims work for client side autopilot |
1385 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) | 1386 | // if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) |
1386 | m_updateCount = UPDATE_COUNT; | 1387 | // m_updateCount = UPDATE_COUNT; |
1387 | 1388 | // | |
1388 | // Make turning in place work | 1389 | // // Make turning in place work |
1389 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || | 1390 | // if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || |
1390 | (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) | 1391 | // (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) |
1391 | m_updateCount = UPDATE_COUNT; | 1392 | // m_updateCount = UPDATE_COUNT; |
1392 | 1393 | ||
1393 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 1394 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
1394 | { | 1395 | { |
@@ -1597,8 +1598,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1597 | // } | 1598 | // } |
1598 | // } | 1599 | // } |
1599 | 1600 | ||
1600 | if (update_movementflag && ParentID == 0) | 1601 | // if (update_movementflag && ParentID == 0) |
1601 | Animator.UpdateMovementAnimations(); | 1602 | // Animator.UpdateMovementAnimations(); |
1602 | } | 1603 | } |
1603 | 1604 | ||
1604 | m_scene.EventManager.TriggerOnClientMovement(this); | 1605 | m_scene.EventManager.TriggerOnClientMovement(this); |
@@ -2315,13 +2316,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2315 | 2316 | ||
2316 | public void HandleAgentSitOnGround() | 2317 | public void HandleAgentSitOnGround() |
2317 | { | 2318 | { |
2318 | m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. | 2319 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. |
2319 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 2320 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
2320 | |||
2321 | // TODO: This doesn't prevent the user from walking yet. | ||
2322 | // Setting parent ID would fix this, if we knew what value | ||
2323 | // to use. Or we could add a m_isSitting variable. | ||
2324 | //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | ||
2325 | SitGround = true; | 2321 | SitGround = true; |
2326 | RemoveFromPhysicalScene(); | 2322 | RemoveFromPhysicalScene(); |
2327 | } | 2323 | } |
@@ -2933,9 +2929,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2933 | 2929 | ||
2934 | public void Reset() | 2930 | public void Reset() |
2935 | { | 2931 | { |
2932 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); | ||
2933 | |||
2936 | // Put the child agent back at the center | 2934 | // Put the child agent back at the center |
2937 | AbsolutePosition | 2935 | AbsolutePosition |
2938 | = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); | 2936 | = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); |
2937 | |||
2939 | Animator.ResetAnimations(); | 2938 | Animator.ResetAnimations(); |
2940 | } | 2939 | } |
2941 | 2940 | ||
@@ -3158,7 +3157,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3158 | } | 3157 | } |
3159 | } | 3158 | } |
3160 | 3159 | ||
3161 | public void CopyFrom(AgentData cAgent) | 3160 | private void CopyFrom(AgentData cAgent) |
3162 | { | 3161 | { |
3163 | m_originRegionID = cAgent.RegionID; | 3162 | m_originRegionID = cAgent.RegionID; |
3164 | 3163 | ||
@@ -3217,13 +3216,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3217 | } | 3216 | } |
3218 | } | 3217 | } |
3219 | catch { } | 3218 | catch { } |
3220 | // Animations | 3219 | |
3221 | try | 3220 | // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? |
3222 | { | 3221 | if (cAgent.Anims != null) |
3223 | Animator.ResetAnimations(); | ||
3224 | Animator.Animations.FromArray(cAgent.Anims); | 3222 | Animator.Animations.FromArray(cAgent.Anims); |
3225 | } | ||
3226 | catch { } | ||
3227 | 3223 | ||
3228 | if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) | 3224 | if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) |
3229 | { | 3225 | { |
@@ -3305,19 +3301,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
3305 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); | 3301 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); |
3306 | } | 3302 | } |
3307 | 3303 | ||
3308 | // Event called by the physics plugin to tell the avatar about a collision. | 3304 | /// <summary> |
3309 | private void PhysicsCollisionUpdate(EventArgs e) | 3305 | /// Event called by the physics plugin to tell the avatar about a collision. |
3306 | /// </summary> | ||
3307 | /// <remarks> | ||
3308 | /// This function is called continuously, even when there are no collisions. If the avatar is walking on the | ||
3309 | /// ground or a prim then there will be collision information between the avatar and the surface. | ||
3310 | /// | ||
3311 | /// FIXME: However, we can't safely avoid calling this yet where there are no collisions without analyzing whether | ||
3312 | /// any part of this method is relying on an every-frame call. | ||
3313 | /// </remarks> | ||
3314 | /// <param name="e"></param> | ||
3315 | public void PhysicsCollisionUpdate(EventArgs e) | ||
3310 | { | 3316 | { |
3317 | if (IsChildAgent) | ||
3318 | return; | ||
3319 | |||
3311 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) | 3320 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) |
3312 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( | 3321 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( |
3313 | // as of this comment the interval is set in AddToPhysicalScene | 3322 | // as of this comment the interval is set in AddToPhysicalScene |
3314 | if (Animator != null) | 3323 | if (Animator != null) |
3315 | { | 3324 | { |
3316 | if (m_updateCount > 0) | 3325 | // if (m_updateCount > 0) |
3317 | { | 3326 | // { |
3318 | Animator.UpdateMovementAnimations(); | 3327 | Animator.UpdateMovementAnimations(); |
3319 | m_updateCount--; | 3328 | // m_updateCount--; |
3320 | } | 3329 | // } |
3321 | } | 3330 | } |
3322 | 3331 | ||
3323 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3332 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
@@ -3325,13 +3334,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3325 | 3334 | ||
3326 | CollisionPlane = Vector4.UnitW; | 3335 | CollisionPlane = Vector4.UnitW; |
3327 | 3336 | ||
3328 | // No collisions at all means we may be flying. Update always | 3337 | // // No collisions at all means we may be flying. Update always |
3329 | // to make falling work | 3338 | // // to make falling work |
3330 | if (m_lastColCount != coldata.Count || coldata.Count == 0) | 3339 | // if (m_lastColCount != coldata.Count || coldata.Count == 0) |
3331 | { | 3340 | // { |
3332 | m_updateCount = UPDATE_COUNT; | 3341 | // m_updateCount = UPDATE_COUNT; |
3333 | m_lastColCount = coldata.Count; | 3342 | // m_lastColCount = coldata.Count; |
3334 | } | 3343 | // } |
3335 | 3344 | ||
3336 | if (coldata.Count != 0 && Animator != null) | 3345 | if (coldata.Count != 0 && Animator != null) |
3337 | { | 3346 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index f0bbf0b..d4c299f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -31,7 +31,7 @@ using System.Reflection; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Timers; | 33 | using System.Timers; |
34 | using Timer=System.Timers.Timer; | 34 | using Timer = System.Timers.Timer; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
@@ -39,11 +39,13 @@ using OpenSim.Framework; | |||
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.ClientStack.Linden; | ||
42 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | 43 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; |
43 | using OpenSim.Region.CoreModules.World.Serialiser; | 44 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
48 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
47 | 49 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 50 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 51 | { |
@@ -103,21 +105,71 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
103 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 105 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
104 | 106 | ||
105 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); | 107 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); |
108 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | ||
106 | 109 | ||
107 | scene.IncomingCloseAgent(sp.UUID); | 110 | scene.IncomingCloseAgent(sp.UUID); |
108 | 111 | ||
109 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); | 112 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); |
110 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); | 113 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); |
114 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0)); | ||
115 | } | ||
116 | |||
117 | [Test] | ||
118 | public void TestCreateChildScenePresence() | ||
119 | { | ||
120 | TestHelpers.InMethod(); | ||
121 | // log4net.Config.XmlConfigurator.Configure(); | ||
122 | |||
123 | LocalSimulationConnectorModule lsc = new LocalSimulationConnectorModule(); | ||
124 | |||
125 | IConfigSource configSource = new IniConfigSource(); | ||
126 | IConfig config = configSource.AddConfig("Modules"); | ||
127 | config.Set("SimulationServices", "LocalSimulationConnectorModule"); | ||
128 | |||
129 | TestScene scene = SceneHelpers.SetupScene(); | ||
130 | SceneHelpers.SetupSceneModules(scene, configSource, lsc); | ||
131 | |||
132 | UUID agentId = TestHelpers.ParseTail(0x01); | ||
133 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(agentId); | ||
134 | acd.child = true; | ||
135 | |||
136 | GridRegion region = scene.GridService.GetRegionByName(UUID.Zero, scene.RegionInfo.RegionName); | ||
137 | string reason; | ||
138 | |||
139 | // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and | ||
140 | // establish a child scene presence. We pass in the circuit code that the client has to connect with *** | ||
141 | // XXX: ViaLogin may not be correct here. | ||
142 | scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason); | ||
143 | |||
144 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); | ||
145 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | ||
146 | |||
147 | // There's no scene presence yet since only an agent circuit has been established. | ||
148 | Assert.That(scene.GetScenePresence(agentId), Is.Null); | ||
149 | |||
150 | // *** This is the second stage, where the client established a child agent/scene presence using the | ||
151 | // circuit code given to the scene in stage 1 *** | ||
152 | TestClient client = new TestClient(acd, scene); | ||
153 | scene.AddNewClient(client, PresenceType.User); | ||
154 | |||
155 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); | ||
156 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | ||
157 | |||
158 | ScenePresence sp = scene.GetScenePresence(agentId); | ||
159 | Assert.That(sp, Is.Not.Null); | ||
160 | Assert.That(sp.UUID, Is.EqualTo(agentId)); | ||
161 | Assert.That(sp.IsChildAgent, Is.True); | ||
111 | } | 162 | } |
112 | 163 | ||
113 | /// <summary> | 164 | /// <summary> |
114 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region | 165 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region |
115 | /// </summary> | 166 | /// </summary> |
116 | /// <remarks> | 167 | /// <remarks> |
117 | /// Please note that unlike the other tests here, this doesn't rely on structures | 168 | /// Please note that unlike the other tests here, this doesn't rely on anything set up in the instance fields. |
169 | /// INCOMPLETE | ||
118 | /// </remarks> | 170 | /// </remarks> |
119 | [Test] | 171 | [Test] |
120 | public void TestChildAgentEstablished() | 172 | public void TestChildAgentEstablishedInNeighbour() |
121 | { | 173 | { |
122 | TestHelpers.InMethod(); | 174 | TestHelpers.InMethod(); |
123 | // log4net.Config.XmlConfigurator.Configure(); | 175 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -125,18 +177,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
125 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 177 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
126 | 178 | ||
127 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); | 179 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
128 | // TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); | 180 | TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
129 | 181 | ||
130 | IConfigSource configSource = new IniConfigSource(); | 182 | IConfigSource configSource = new IniConfigSource(); |
131 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); | 183 | IConfig config = configSource.AddConfig("Startup"); |
184 | config.Set("serverside_object_permissions", true); | ||
185 | config.Set("EventQueue", true); | ||
186 | |||
132 | EntityTransferModule etm = new EntityTransferModule(); | 187 | EntityTransferModule etm = new EntityTransferModule(); |
188 | |||
189 | EventQueueGetModule eqgm1 = new EventQueueGetModule(); | ||
190 | SceneHelpers.SetupSceneModules(myScene1, configSource, etm, eqgm1); | ||
191 | |||
192 | EventQueueGetModule eqgm2 = new EventQueueGetModule(); | ||
193 | SceneHelpers.SetupSceneModules(myScene2, configSource, etm, eqgm2); | ||
133 | 194 | ||
134 | SceneHelpers.SetupSceneModules(myScene1, configSource, etm); | 195 | // SceneHelpers.AddScenePresence(myScene1, agent1Id); |
135 | |||
136 | SceneHelpers.AddScenePresence(myScene1, agent1Id); | ||
137 | // ScenePresence childPresence = myScene2.GetScenePresence(agent1); | 196 | // ScenePresence childPresence = myScene2.GetScenePresence(agent1); |
138 | 197 | // | |
139 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents | 198 | // // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents |
140 | // Assert.That(childPresence, Is.Not.Null); | 199 | // Assert.That(childPresence, Is.Not.Null); |
141 | // Assert.That(childPresence.IsChildAgent, Is.True); | 200 | // Assert.That(childPresence.IsChildAgent, Is.True); |
142 | } | 201 | } |
@@ -194,48 +253,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
194 | // Assert.That(presence, Is.Null, "presence is not null"); | 253 | // Assert.That(presence, Is.Null, "presence is not null"); |
195 | // } | 254 | // } |
196 | 255 | ||
197 | [Test] | ||
198 | public void T012_TestAddNeighbourRegion() | ||
199 | { | ||
200 | TestHelpers.InMethod(); | ||
201 | |||
202 | string reason; | ||
203 | |||
204 | if (acd1 == null) | ||
205 | fixNullPresence(); | ||
206 | |||
207 | scene.NewUserConnection(acd1, 0, out reason); | ||
208 | if (testclient == null) | ||
209 | testclient = new TestClient(acd1, scene); | ||
210 | scene.AddNewClient(testclient, PresenceType.User); | ||
211 | |||
212 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
213 | presence.MakeRootAgent(new Vector3(90,90,90),false); | ||
214 | |||
215 | string cap = presence.ControllingClient.RequestClientInfo().CapsPath; | ||
216 | |||
217 | presence.AddNeighbourRegion(region2, cap); | ||
218 | presence.AddNeighbourRegion(region3, cap); | ||
219 | |||
220 | Assert.That(presence.KnownRegionCount, Is.EqualTo(2)); | ||
221 | } | ||
222 | |||
223 | [Test] | ||
224 | public void T013_TestRemoveNeighbourRegion() | ||
225 | { | ||
226 | TestHelpers.InMethod(); | ||
227 | |||
228 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
229 | presence.RemoveNeighbourRegion(region3); | ||
230 | |||
231 | Assert.That(presence.KnownRegionCount,Is.EqualTo(1)); | ||
232 | /* | ||
233 | presence.MakeChildAgent; | ||
234 | presence.MakeRootAgent; | ||
235 | CompleteAvatarMovement | ||
236 | */ | ||
237 | } | ||
238 | |||
239 | // I'm commenting this test because it does not represent | 256 | // I'm commenting this test because it does not represent |
240 | // crossings. The Thread.Sleep's in here are not meaningful mocks, | 257 | // crossings. The Thread.Sleep's in here are not meaningful mocks, |
241 | // and they sometimes fail in panda. | 258 | // and they sometimes fail in panda. |
@@ -338,33 +355,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
338 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); | 355 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); |
339 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); | 356 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); |
340 | } | 357 | } |
341 | |||
342 | public void fixNullPresence() | ||
343 | { | ||
344 | string firstName = "testfirstname"; | ||
345 | |||
346 | AgentCircuitData agent = new AgentCircuitData(); | ||
347 | agent.AgentID = agent1; | ||
348 | agent.firstname = firstName; | ||
349 | agent.lastname = "testlastname"; | ||
350 | agent.SessionID = UUID.Zero; | ||
351 | agent.SecureSessionID = UUID.Zero; | ||
352 | agent.circuitcode = 123; | ||
353 | agent.BaseFolder = UUID.Zero; | ||
354 | agent.InventoryFolder = UUID.Zero; | ||
355 | agent.startpos = Vector3.Zero; | ||
356 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
357 | agent.Appearance = new AvatarAppearance(); | ||
358 | |||
359 | acd1 = agent; | ||
360 | } | ||
361 | |||
362 | public static string GetRandomCapsObjectPath() | ||
363 | { | ||
364 | UUID caps = UUID.Random(); | ||
365 | string capsPath = caps.ToString(); | ||
366 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); | ||
367 | return capsPath; | ||
368 | } | ||
369 | } | 358 | } |
370 | } \ No newline at end of file | 359 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs new file mode 100644 index 0000000..4a0533c --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs | |||
@@ -0,0 +1,70 @@ | |||
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 System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Nini.Config; | ||
35 | using NUnit.Framework; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
42 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
44 | using OpenSim.Region.Physics.Manager; | ||
45 | using OpenSim.Tests.Common; | ||
46 | using OpenSim.Tests.Common.Mock; | ||
47 | |||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
49 | { | ||
50 | /// <summary> | ||
51 | /// Scene presence animation tests | ||
52 | /// </summary> | ||
53 | [TestFixture] | ||
54 | public class ScenePresenceAnimationTests | ||
55 | { | ||
56 | [Test] | ||
57 | public void TestFlyingAnimation() | ||
58 | { | ||
59 | TestHelpers.InMethod(); | ||
60 | // log4net.Config.XmlConfigurator.Configure(); | ||
61 | |||
62 | TestScene scene = SceneHelpers.SetupScene(); | ||
63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
64 | sp.PhysicsActor.Flying = true; | ||
65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); | ||
66 | |||
67 | Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER")); | ||
68 | } | ||
69 | } | ||
70 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ea99113..d08712a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5975,7 +5975,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5975 | flags |= ScriptBaseClass.AGENT_TYPING; | 5975 | flags |= ScriptBaseClass.AGENT_TYPING; |
5976 | } | 5976 | } |
5977 | 5977 | ||
5978 | string agentMovementAnimation = agent.Animator.GetMovementAnimation(); | 5978 | string agentMovementAnimation = agent.Animator.CurrentMovementAnimation; |
5979 | 5979 | ||
5980 | if (agentMovementAnimation == "CROUCH") | 5980 | if (agentMovementAnimation == "CROUCH") |
5981 | { | 5981 | { |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs index 39baa32..4accea1 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs | |||
@@ -45,9 +45,11 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
45 | base(config, server, configName) | 45 | base(config, server, configName) |
46 | { | 46 | { |
47 | server.AddStreamHandler(new HeloServerGetHandler("opensim-robust")); | 47 | server.AddStreamHandler(new HeloServerGetHandler("opensim-robust")); |
48 | server.AddStreamHandler(new HeloServerHeadHandler("opensim-robust")); | ||
48 | } | 49 | } |
49 | } | 50 | } |
50 | 51 | ||
52 | [Obsolete] | ||
51 | public class HeloServerGetHandler : BaseStreamHandler | 53 | public class HeloServerGetHandler : BaseStreamHandler |
52 | { | 54 | { |
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -68,7 +70,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
68 | 70 | ||
69 | private byte[] OKResponse(OSHttpResponse httpResponse) | 71 | private byte[] OKResponse(OSHttpResponse httpResponse) |
70 | { | 72 | { |
71 | m_log.Debug("[HELO]: hi, I was called"); | 73 | m_log.Debug("[HELO]: hi, GET was called"); |
72 | httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType); | 74 | httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType); |
73 | httpResponse.StatusCode = (int)HttpStatusCode.OK; | 75 | httpResponse.StatusCode = (int)HttpStatusCode.OK; |
74 | httpResponse.StatusDescription = "OK"; | 76 | httpResponse.StatusDescription = "OK"; |
@@ -76,4 +78,34 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
76 | } | 78 | } |
77 | 79 | ||
78 | } | 80 | } |
81 | |||
82 | public class HeloServerHeadHandler : BaseStreamHandler | ||
83 | { | ||
84 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
85 | |||
86 | private string m_HandlersType; | ||
87 | |||
88 | public HeloServerHeadHandler(string handlersType) : | ||
89 | base("HEAD", "/helo") | ||
90 | { | ||
91 | m_HandlersType = handlersType; | ||
92 | } | ||
93 | |||
94 | public override byte[] Handle(string path, Stream requestData, | ||
95 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
96 | { | ||
97 | return OKResponse(httpResponse); | ||
98 | } | ||
99 | |||
100 | private byte[] OKResponse(OSHttpResponse httpResponse) | ||
101 | { | ||
102 | m_log.Debug("[HELO]: hi, HEAD was called"); | ||
103 | httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType); | ||
104 | httpResponse.StatusCode = (int)HttpStatusCode.OK; | ||
105 | httpResponse.StatusDescription = "OK"; | ||
106 | return new byte[0]; | ||
107 | } | ||
108 | |||
109 | } | ||
110 | |||
79 | } | 111 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 72a4aea..50010f2 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | |||
@@ -143,7 +143,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
143 | UUID.TryParse(sessionID_str, out sessionID); | 143 | UUID.TryParse(sessionID_str, out sessionID); |
144 | string gridName = (string)requestData["externalName"]; | 144 | string gridName = (string)requestData["externalName"]; |
145 | 145 | ||
146 | bool success = m_HomeUsersService.AgentIsComingHome(sessionID, gridName); | 146 | bool success = m_HomeUsersService.IsAgentComingHome(sessionID, gridName); |
147 | 147 | ||
148 | Hashtable hash = new Hashtable(); | 148 | Hashtable hash = new Hashtable(); |
149 | hash["result"] = success.ToString(); | 149 | hash["result"] = success.ToString(); |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs index 7b166c1..7cfd6e8 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs | |||
@@ -54,6 +54,8 @@ namespace OpenSim.Services.Connectors | |||
54 | public virtual string Helo() | 54 | public virtual string Helo() |
55 | { | 55 | { |
56 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo"); | 56 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo"); |
57 | // Eventually we need to switch to HEAD | ||
58 | /* req.Method = "HEAD"; */ | ||
57 | 59 | ||
58 | try | 60 | try |
59 | { | 61 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 2c36bf5..a59b9ee 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -356,7 +356,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
356 | return null; | 356 | return null; |
357 | } | 357 | } |
358 | 358 | ||
359 | public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName) | 359 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) |
360 | { | 360 | { |
361 | Hashtable hash = new Hashtable(); | 361 | Hashtable hash = new Hashtable(); |
362 | hash["sessionID"] = sessionID.ToString(); | 362 | hash["sessionID"] = sessionID.ToString(); |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index e26383f..5d99c79 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -243,7 +243,7 @@ namespace OpenSim.Services.HypergridService | |||
243 | // Make sure this is the user coming home, and not a foreign user with same UUID as a local user | 243 | // Make sure this is the user coming home, and not a foreign user with same UUID as a local user |
244 | if (m_UserAgentService != null) | 244 | if (m_UserAgentService != null) |
245 | { | 245 | { |
246 | if (!m_UserAgentService.AgentIsComingHome(aCircuit.SessionID, m_ExternalName)) | 246 | if (!m_UserAgentService.IsAgentComingHome(aCircuit.SessionID, m_ExternalName)) |
247 | { | 247 | { |
248 | // Can't do, sorry | 248 | // Can't do, sorry |
249 | reason = "Unauthorized"; | 249 | reason = "Unauthorized"; |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index ac53583..398a7b7 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -281,7 +281,7 @@ namespace OpenSim.Services.HypergridService | |||
281 | } | 281 | } |
282 | 282 | ||
283 | // We need to prevent foreign users with the same UUID as a local user | 283 | // We need to prevent foreign users with the same UUID as a local user |
284 | public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName) | 284 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) |
285 | { | 285 | { |
286 | if (!m_TravelingAgents.ContainsKey(sessionID)) | 286 | if (!m_TravelingAgents.ContainsKey(sessionID)) |
287 | return false; | 287 | return false; |
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 220caef..e86ec51 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Services.Interfaces | |||
65 | List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); | 65 | List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); |
66 | //List<UUID> GetOnlineFriends(UUID userID, List<string> friends); | 66 | //List<UUID> GetOnlineFriends(UUID userID, List<string> friends); |
67 | 67 | ||
68 | bool AgentIsComingHome(UUID sessionID, string thisGridExternalName); | 68 | bool IsAgentComingHome(UUID sessionID, string thisGridExternalName); |
69 | bool VerifyAgent(UUID sessionID, string token); | 69 | bool VerifyAgent(UUID sessionID, string token); |
70 | bool VerifyClient(UUID sessionID, string reportedIP); | 70 | bool VerifyClient(UUID sessionID, string reportedIP); |
71 | } | 71 | } |
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index d358ae8..a25eb66 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -49,6 +49,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; | |||
49 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; | 49 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; |
50 | using OpenSim.Services.Interfaces; | 50 | using OpenSim.Services.Interfaces; |
51 | using OpenSim.Tests.Common.Mock; | 51 | using OpenSim.Tests.Common.Mock; |
52 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
52 | 53 | ||
53 | namespace OpenSim.Tests.Common | 54 | namespace OpenSim.Tests.Common |
54 | { | 55 | { |
@@ -139,6 +140,7 @@ namespace OpenSim.Tests.Common | |||
139 | 140 | ||
140 | testScene.RegionInfo.EstateSettings = new EstateSettings(); | 141 | testScene.RegionInfo.EstateSettings = new EstateSettings(); |
141 | testScene.LoginsDisabled = false; | 142 | testScene.LoginsDisabled = false; |
143 | testScene.RegisterRegionWithGrid(); | ||
142 | 144 | ||
143 | return testScene; | 145 | return testScene; |
144 | } | 146 | } |
@@ -222,6 +224,7 @@ namespace OpenSim.Tests.Common | |||
222 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); | 224 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); |
223 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); | 225 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); |
224 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); | 226 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); |
227 | config.Configs["GridService"].Set("ConnectionString", "!static"); | ||
225 | 228 | ||
226 | LocalGridServicesConnector gridService = new LocalGridServicesConnector(); | 229 | LocalGridServicesConnector gridService = new LocalGridServicesConnector(); |
227 | gridService.Initialise(config); | 230 | gridService.Initialise(config); |
@@ -393,27 +396,42 @@ namespace OpenSim.Tests.Common | |||
393 | /// <returns></returns> | 396 | /// <returns></returns> |
394 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) | 397 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) |
395 | { | 398 | { |
396 | string reason; | ||
397 | |||
398 | // We emulate the proper login sequence here by doing things in four stages | 399 | // We emulate the proper login sequence here by doing things in four stages |
399 | 400 | ||
400 | // Stage 0: log the presence | 401 | // Stage 0: login |
401 | scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); | 402 | scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); |
402 | 403 | ||
403 | // Stage 1: simulate login by telling the scene to expect a new user connection | 404 | // Stages 1 & 2 |
404 | if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) | 405 | ScenePresence sp = IntroduceClientToScene(scene, agentData, TeleportFlags.ViaLogin); |
406 | |||
407 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. | ||
408 | sp.CompleteMovement(sp.ControllingClient, true); | ||
409 | |||
410 | return sp; | ||
411 | } | ||
412 | |||
413 | private static ScenePresence IntroduceClientToScene(Scene scene, AgentCircuitData agentData, TeleportFlags tf) | ||
414 | { | ||
415 | string reason; | ||
416 | |||
417 | // Stage 1: tell the scene to expect a new user connection | ||
418 | if (!scene.NewUserConnection(agentData, (uint)tf, out reason)) | ||
405 | Console.WriteLine("NewUserConnection failed: " + reason); | 419 | Console.WriteLine("NewUserConnection failed: " + reason); |
406 | 420 | ||
407 | // Stage 2: add the new client as a child agent to the scene | 421 | // Stage 2: add the new client as a child agent to the scene |
408 | TestClient client = new TestClient(agentData, scene); | 422 | TestClient client = new TestClient(agentData, scene); |
409 | scene.AddNewClient(client, PresenceType.User); | 423 | scene.AddNewClient(client, PresenceType.User); |
410 | 424 | ||
411 | // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. | 425 | return scene.GetScenePresence(agentData.AgentID); |
412 | ScenePresence scp = scene.GetScenePresence(agentData.AgentID); | 426 | } |
413 | scp.CompleteMovement(client, true); | 427 | |
414 | //scp.MakeRootAgent(new Vector3(90, 90, 90), true); | 428 | public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) |
429 | { | ||
430 | AgentCircuitData acd = GenerateAgentData(agentId); | ||
431 | acd.child = true; | ||
415 | 432 | ||
416 | return scp; | 433 | // XXX: ViaLogin may not be correct for child agents |
434 | return IntroduceClientToScene(scene, acd, TeleportFlags.ViaLogin); | ||
417 | } | 435 | } |
418 | 436 | ||
419 | /// <summary> | 437 | /// <summary> |