aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2011-12-05 15:29:00 -0500
committerBlueWall2011-12-05 15:29:00 -0500
commit2d3dda6db391d0b74459ba0b4d77e13078b76913 (patch)
treeb3391ff60a778b6809742cb0d1e53a67ece1b63c
parentMerge branch 'master' of /home/opensim/var/repo/opensim (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-2d3dda6db391d0b74459ba0b4d77e13078b76913.zip
opensim-SC_OLD-2d3dda6db391d0b74459ba0b4d77e13078b76913.tar.gz
opensim-SC_OLD-2d3dda6db391d0b74459ba0b4d77e13078b76913.tar.bz2
opensim-SC_OLD-2d3dda6db391d0b74459ba0b4d77e13078b76913.tar.xz
Merge branch 'master' of /home/opensim/var/repo/opensim
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs39
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs40
-rw-r--r--OpenSim/Framework/AgentCircuitManager.cs127
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitManagerTests.cs2
-rw-r--r--OpenSim/Framework/Tests/AnimationTests.cs2
-rw-r--r--OpenSim/Region/Application/OpenSim.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs90
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs151
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs36
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs34
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs2
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs2
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs2
-rw-r--r--OpenSim/Services/Interfaces/IHypergridServices.cs2
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs38
-rw-r--r--prebuild.xml1
22 files changed, 355 insertions, 243 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 245d931..7ab30ce 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -111,6 +111,10 @@ namespace OpenSim.Capabilities.Handlers
111 m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url); 111 m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
112 } 112 }
113 113
114// m_log.DebugFormat(
115// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
116// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
117
114 httpResponse.Send(); 118 httpResponse.Send();
115 return null; 119 return null;
116 } 120 }
@@ -210,7 +214,7 @@ namespace OpenSim.Capabilities.Handlers
210 private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format) 214 private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format)
211 { 215 {
212 string range = request.Headers.GetOne("Range"); 216 string range = request.Headers.GetOne("Range");
213 //m_log.DebugFormat("[GETTEXTURE]: Range {0}", range); 217
214 if (!String.IsNullOrEmpty(range)) // JP2's only 218 if (!String.IsNullOrEmpty(range)) // JP2's only
215 { 219 {
216 // Range request 220 // Range request
@@ -222,23 +226,27 @@ namespace OpenSim.Capabilities.Handlers
222 if (start >= texture.Data.Length) 226 if (start >= texture.Data.Length)
223 { 227 {
224 response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable; 228 response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
225 return;
226 } 229 }
230 else
231 {
232 end = Utils.Clamp(end, 0, texture.Data.Length - 1);
233 start = Utils.Clamp(start, 0, end);
234 int len = end - start + 1;
227 235
228 end = Utils.Clamp(end, 0, texture.Data.Length - 1); 236 //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
229 start = Utils.Clamp(start, 0, end);
230 int len = end - start + 1;
231
232 //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
233 237
234 if (len < texture.Data.Length) 238 // Always return PartialContent, even if the range covered the entire data length
239 // We were accidentally sending back 404 before in this situation
240 // https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
241 // entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this.
235 response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; 242 response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
236 243
237 response.ContentLength = len; 244 response.ContentLength = len;
238 response.ContentType = texture.Metadata.ContentType; 245 response.ContentType = texture.Metadata.ContentType;
239 response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length)); 246 response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
240 247
241 response.Body.Write(texture.Data, start, len); 248 response.Body.Write(texture.Data, start, len);
249 }
242 } 250 }
243 else 251 else
244 { 252 {
@@ -257,6 +265,10 @@ namespace OpenSim.Capabilities.Handlers
257 response.ContentType = "image/" + format; 265 response.ContentType = "image/" + format;
258 response.Body.Write(texture.Data, 0, texture.Data.Length); 266 response.Body.Write(texture.Data, 0, texture.Data.Length);
259 } 267 }
268
269// m_log.DebugFormat(
270// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
271// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
260 } 272 }
261 273
262 private bool TryParseRange(string header, out int start, out int end) 274 private bool TryParseRange(string header, out int start, out int end)
@@ -275,7 +287,6 @@ namespace OpenSim.Capabilities.Handlers
275 return false; 287 return false;
276 } 288 }
277 289
278
279 private byte[] ConvertTextureData(AssetBase texture, string format) 290 private byte[] ConvertTextureData(AssetBase texture, string format)
280 { 291 {
281 m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format); 292 m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
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 4b38a2e..8d98cc9 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/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 99064c8..2f947fd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1341,7 +1341,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1341 1341
1342 string reason = String.Empty; 1342 string reason = String.Empty;
1343 1343
1344
1345 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); 1344 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
1346 1345
1347 if (regionAccepted && newAgent) 1346 if (regionAccepted && newAgent)
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index f2c8b3d..18bd018 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
355 // I'm pretty sure noone whats to set fullbright true if it wasn't true before. 355 // I'm pretty sure noone whats to set fullbright true if it wasn't true before.
356 // tmptex.DefaultTexture.Fullbright = true; 356 // tmptex.DefaultTexture.Fullbright = true;
357 357
358 part.UpdateTexture(tmptex); 358 part.UpdateTextureEntry(tmptex.GetBytes());
359 } 359 }
360 360
361 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) 361 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
@@ -437,4 +437,4 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
437 437
438 #endregion 438 #endregion
439 } 439 }
440} \ No newline at end of file 440}
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;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
37using Nini.Config;
38
39using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion; 40using 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/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 24322a1..c8b39a4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3178,7 +3178,10 @@ namespace OpenSim.Region.Framework.Scenes
3178 /// <param name="face"></param> 3178 /// <param name="face"></param>
3179 public void SetFaceColor(Vector3 color, int face) 3179 public void SetFaceColor(Vector3 color, int face)
3180 { 3180 {
3181 Primitive.TextureEntry tex = Shape.Textures; 3181 // The only way to get a deep copy/ If we don't do this, we can
3182 // mever detect color changes further down.
3183 Byte[] buf = Shape.Textures.GetBytes();
3184 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
3182 Color4 texcolor; 3185 Color4 texcolor;
3183 if (face >= 0 && face < GetNumberOfSides()) 3186 if (face >= 0 && face < GetNumberOfSides())
3184 { 3187 {
@@ -3187,8 +3190,7 @@ namespace OpenSim.Region.Framework.Scenes
3187 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3190 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
3188 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3191 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
3189 tex.FaceTextures[face].RGBA = texcolor; 3192 tex.FaceTextures[face].RGBA = texcolor;
3190 UpdateTexture(tex); 3193 UpdateTextureEntry(tex.GetBytes());
3191 TriggerScriptChangedEvent(Changed.COLOR);
3192 return; 3194 return;
3193 } 3195 }
3194 else if (face == ALL_SIDES) 3196 else if (face == ALL_SIDES)
@@ -3209,8 +3211,7 @@ namespace OpenSim.Region.Framework.Scenes
3209 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3211 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
3210 tex.DefaultTexture.RGBA = texcolor; 3212 tex.DefaultTexture.RGBA = texcolor;
3211 } 3213 }
3212 UpdateTexture(tex); 3214 UpdateTextureEntry(tex.GetBytes());
3213 TriggerScriptChangedEvent(Changed.COLOR);
3214 return; 3215 return;
3215 } 3216 }
3216 } 3217 }
@@ -3272,9 +3273,14 @@ namespace OpenSim.Region.Framework.Scenes
3272 if (hasHollow) ret += 1; 3273 if (hasHollow) ret += 1;
3273 break; 3274 break;
3274 case PrimType.SCULPT: 3275 case PrimType.SCULPT:
3275 ret = 1; 3276 // Special mesh handling
3277 if (Shape.SculptType == (byte)SculptType.Mesh)
3278 ret = 8; // if it's a mesh then max 8 faces
3279 else
3280 ret = 1; // if it's a sculpt then max 1 face
3276 break; 3281 break;
3277 } 3282 }
3283
3278 return ret; 3284 return ret;
3279 } 3285 }
3280 3286
@@ -3287,6 +3293,7 @@ namespace OpenSim.Region.Framework.Scenes
3287 { 3293 {
3288 if (Shape.SculptEntry) 3294 if (Shape.SculptEntry)
3289 return PrimType.SCULPT; 3295 return PrimType.SCULPT;
3296
3290 if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) 3297 if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
3291 { 3298 {
3292 if (Shape.PathCurve == (byte)Extrusion.Straight) 3299 if (Shape.PathCurve == (byte)Extrusion.Straight)
@@ -4532,48 +4539,49 @@ namespace OpenSim.Region.Framework.Scenes
4532 } 4539 }
4533 4540
4534 /// <summary> 4541 /// <summary>
4535 /// Update the textures on the part.
4536 /// </summary>
4537 /// <remarks>
4538 /// Added to handle bug in libsecondlife's TextureEntry.ToBytes()
4539 /// not handling RGBA properly. Cycles through, and "fixes" the color
4540 /// info
4541 /// </remarks>
4542 /// <param name="tex"></param>
4543 public void UpdateTexture(Primitive.TextureEntry tex)
4544 {
4545 //Color4 tmpcolor;
4546 //for (uint i = 0; i < 32; i++)
4547 //{
4548 // if (tex.FaceTextures[i] != null)
4549 // {
4550 // tmpcolor = tex.GetFace((uint) i).RGBA;
4551 // tmpcolor.A = tmpcolor.A*255;
4552 // tmpcolor.R = tmpcolor.R*255;
4553 // tmpcolor.G = tmpcolor.G*255;
4554 // tmpcolor.B = tmpcolor.B*255;
4555 // tex.FaceTextures[i].RGBA = tmpcolor;
4556 // }
4557 //}
4558 //tmpcolor = tex.DefaultTexture.RGBA;
4559 //tmpcolor.A = tmpcolor.A*255;
4560 //tmpcolor.R = tmpcolor.R*255;
4561 //tmpcolor.G = tmpcolor.G*255;
4562 //tmpcolor.B = tmpcolor.B*255;
4563 //tex.DefaultTexture.RGBA = tmpcolor;
4564 UpdateTextureEntry(tex.GetBytes());
4565 }
4566
4567 /// <summary>
4568 /// Update the texture entry for this part. 4542 /// Update the texture entry for this part.
4569 /// </summary> 4543 /// </summary>
4570 /// <param name="textureEntry"></param> 4544 /// <param name="textureEntry"></param>
4571 public void UpdateTextureEntry(byte[] textureEntry) 4545 public void UpdateTextureEntry(byte[] textureEntry)
4572 { 4546 {
4573 m_shape.TextureEntry = textureEntry; 4547 Primitive.TextureEntry newTex = new Primitive.TextureEntry(textureEntry, 0, textureEntry.Length);
4574 TriggerScriptChangedEvent(Changed.TEXTURE); 4548 Primitive.TextureEntry oldTex = Shape.Textures;
4575 4549
4550 Changed changeFlags = 0;
4551
4552 for (int i = 0 ; i < GetNumberOfSides(); i++)
4553 {
4554 Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
4555 Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;
4556
4557 if (oldTex.FaceTextures[i] != null)
4558 oldFace = oldTex.FaceTextures[i];
4559 if (newTex.FaceTextures[i] != null)
4560 newFace = newTex.FaceTextures[i];
4561
4562 Color4 oldRGBA = oldFace.RGBA;
4563 Color4 newRGBA = newFace.RGBA;
4564
4565 if (oldRGBA.R != newRGBA.R ||
4566 oldRGBA.G != newRGBA.G ||
4567 oldRGBA.B != newRGBA.B ||
4568 oldRGBA.A != newRGBA.A)
4569 changeFlags |= Changed.COLOR;
4570
4571 if (oldFace.TextureID != newFace.TextureID)
4572 changeFlags |= Changed.TEXTURE;
4573
4574 // Max change, skip the rest of testing
4575 if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
4576 break;
4577 }
4578
4579 m_shape.TextureEntry = textureEntry;
4580 if (changeFlags != 0)
4581 TriggerScriptChangedEvent(changeFlags);
4582 UpdateFlag = UpdateRequired.FULL;
4576 ParentGroup.HasGroupChanged = true; 4583 ParentGroup.HasGroupChanged = true;
4584
4577 //This is madness.. 4585 //This is madness..
4578 //ParentGroup.ScheduleGroupForFullUpdate(); 4586 //ParentGroup.ScheduleGroupForFullUpdate();
4579 //This is sparta 4587 //This is sparta
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;
31using System.Text; 31using System.Text;
32using System.Threading; 32using System.Threading;
33using System.Timers; 33using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer = System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
@@ -39,11 +39,13 @@ using OpenSim.Framework;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.ClientStack.Linden;
42using OpenSim.Region.CoreModules.Framework.EntityTransfer; 43using OpenSim.Region.CoreModules.Framework.EntityTransfer;
43using OpenSim.Region.CoreModules.World.Serialiser; 44using OpenSim.Region.CoreModules.World.Serialiser;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
45using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
48using GridRegion = OpenSim.Services.Interfaces.GridRegion;
47 49
48namespace OpenSim.Region.Framework.Scenes.Tests 50namespace 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/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs
index 0cba6af..cea738c 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
55 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); 55 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
56 texface.RGBA = new Color4(value.R,value.G,value.B,value.A); 56 texface.RGBA = new Color4(value.R,value.G,value.B,value.A);
57 tex.FaceTextures[m_face] = texface; 57 tex.FaceTextures[m_face] = texface;
58 m_parent.UpdateTexture(tex); 58 m_parent.UpdateTextureEntry(tex.GetBytes());
59 } 59 }
60 } 60 }
61 61
@@ -72,7 +72,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
72 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); 72 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
73 texface.TextureID = value; 73 texface.TextureID = value;
74 tex.FaceTextures[m_face] = texface; 74 tex.FaceTextures[m_face] = texface;
75 m_parent.UpdateTexture(tex); 75 m_parent.UpdateTextureEntry(tex.GetBytes());
76 } 76 }
77 } 77 }
78 78
@@ -97,7 +97,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
97 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); 97 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
98 texface.Fullbright = value; 98 texface.Fullbright = value;
99 tex.FaceTextures[m_face] = texface; 99 tex.FaceTextures[m_face] = texface;
100 m_parent.UpdateTexture(tex); 100 m_parent.UpdateTextureEntry(tex.GetBytes());
101 } 101 }
102 } 102 }
103 103
@@ -110,7 +110,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
110 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); 110 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
111 texface.Glow = (float) value; 111 texface.Glow = (float) value;
112 tex.FaceTextures[m_face] = texface; 112 tex.FaceTextures[m_face] = texface;
113 m_parent.UpdateTexture(tex); 113 m_parent.UpdateTextureEntry(tex.GetBytes());
114 } 114 }
115 } 115 }
116 116
@@ -123,7 +123,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
123 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); 123 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
124 texface.Shiny = value ? Shininess.High : Shininess.None; 124 texface.Shiny = value ? Shininess.High : Shininess.None;
125 tex.FaceTextures[m_face] = texface; 125 tex.FaceTextures[m_face] = texface;
126 m_parent.UpdateTexture(tex); 126 m_parent.UpdateTextureEntry(tex.GetBytes());
127 } 127 }
128 } 128 }
129 129
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6c418df..6d067b0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1424,7 +1424,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1424 { 1424 {
1425 tex.CreateFace((uint) face); 1425 tex.CreateFace((uint) face);
1426 tex.FaceTextures[face].TexMapType = textype; 1426 tex.FaceTextures[face].TexMapType = textype;
1427 part.UpdateTexture(tex); 1427 part.UpdateTextureEntry(tex.GetBytes());
1428 return; 1428 return;
1429 } 1429 }
1430 else if (face == ScriptBaseClass.ALL_SIDES) 1430 else if (face == ScriptBaseClass.ALL_SIDES)
@@ -1437,7 +1437,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1437 } 1437 }
1438 tex.DefaultTexture.TexMapType = textype; 1438 tex.DefaultTexture.TexMapType = textype;
1439 } 1439 }
1440 part.UpdateTexture(tex); 1440 part.UpdateTextureEntry(tex.GetBytes());
1441 return; 1441 return;
1442 } 1442 }
1443 } 1443 }
@@ -1449,7 +1449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1449 { 1449 {
1450 tex.CreateFace((uint) face); 1450 tex.CreateFace((uint) face);
1451 tex.FaceTextures[face].Glow = glow; 1451 tex.FaceTextures[face].Glow = glow;
1452 part.UpdateTexture(tex); 1452 part.UpdateTextureEntry(tex.GetBytes());
1453 return; 1453 return;
1454 } 1454 }
1455 else if (face == ScriptBaseClass.ALL_SIDES) 1455 else if (face == ScriptBaseClass.ALL_SIDES)
@@ -1462,7 +1462,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1462 } 1462 }
1463 tex.DefaultTexture.Glow = glow; 1463 tex.DefaultTexture.Glow = glow;
1464 } 1464 }
1465 part.UpdateTexture(tex); 1465 part.UpdateTextureEntry(tex.GetBytes());
1466 return; 1466 return;
1467 } 1467 }
1468 } 1468 }
@@ -1497,7 +1497,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1497 tex.CreateFace((uint) face); 1497 tex.CreateFace((uint) face);
1498 tex.FaceTextures[face].Shiny = sval; 1498 tex.FaceTextures[face].Shiny = sval;
1499 tex.FaceTextures[face].Bump = bump; 1499 tex.FaceTextures[face].Bump = bump;
1500 part.UpdateTexture(tex); 1500 part.UpdateTextureEntry(tex.GetBytes());
1501 return; 1501 return;
1502 } 1502 }
1503 else if (face == ScriptBaseClass.ALL_SIDES) 1503 else if (face == ScriptBaseClass.ALL_SIDES)
@@ -1512,7 +1512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1512 tex.DefaultTexture.Shiny = sval; 1512 tex.DefaultTexture.Shiny = sval;
1513 tex.DefaultTexture.Bump = bump; 1513 tex.DefaultTexture.Bump = bump;
1514 } 1514 }
1515 part.UpdateTexture(tex); 1515 part.UpdateTextureEntry(tex.GetBytes());
1516 return; 1516 return;
1517 } 1517 }
1518 } 1518 }
@@ -1524,7 +1524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1524 { 1524 {
1525 tex.CreateFace((uint) face); 1525 tex.CreateFace((uint) face);
1526 tex.FaceTextures[face].Fullbright = bright; 1526 tex.FaceTextures[face].Fullbright = bright;
1527 part.UpdateTexture(tex); 1527 part.UpdateTextureEntry(tex.GetBytes());
1528 return; 1528 return;
1529 } 1529 }
1530 else if (face == ScriptBaseClass.ALL_SIDES) 1530 else if (face == ScriptBaseClass.ALL_SIDES)
@@ -1537,7 +1537,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1537 } 1537 }
1538 } 1538 }
1539 tex.DefaultTexture.Fullbright = bright; 1539 tex.DefaultTexture.Fullbright = bright;
1540 part.UpdateTexture(tex); 1540 part.UpdateTextureEntry(tex.GetBytes());
1541 return; 1541 return;
1542 } 1542 }
1543 } 1543 }
@@ -1593,7 +1593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1593 texcolor = tex.CreateFace((uint)face).RGBA; 1593 texcolor = tex.CreateFace((uint)face).RGBA;
1594 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); 1594 texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
1595 tex.FaceTextures[face].RGBA = texcolor; 1595 tex.FaceTextures[face].RGBA = texcolor;
1596 part.UpdateTexture(tex); 1596 part.UpdateTextureEntry(tex.GetBytes());
1597 return; 1597 return;
1598 } 1598 }
1599 else if (face == ScriptBaseClass.ALL_SIDES) 1599 else if (face == ScriptBaseClass.ALL_SIDES)
@@ -1617,7 +1617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1617 tex.DefaultTexture.RGBA = texcolor; 1617 tex.DefaultTexture.RGBA = texcolor;
1618 } 1618 }
1619 1619
1620 part.UpdateTexture(tex); 1620 part.UpdateTextureEntry(tex.GetBytes());
1621 return; 1621 return;
1622 } 1622 }
1623 } 1623 }
@@ -1774,7 +1774,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1774 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1774 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1775 texface.TextureID = textureID; 1775 texface.TextureID = textureID;
1776 tex.FaceTextures[face] = texface; 1776 tex.FaceTextures[face] = texface;
1777 part.UpdateTexture(tex); 1777 part.UpdateTextureEntry(tex.GetBytes());
1778 return; 1778 return;
1779 } 1779 }
1780 else if (face == ScriptBaseClass.ALL_SIDES) 1780 else if (face == ScriptBaseClass.ALL_SIDES)
@@ -1787,7 +1787,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1787 } 1787 }
1788 } 1788 }
1789 tex.DefaultTexture.TextureID = textureID; 1789 tex.DefaultTexture.TextureID = textureID;
1790 part.UpdateTexture(tex); 1790 part.UpdateTextureEntry(tex.GetBytes());
1791 return; 1791 return;
1792 } 1792 }
1793 } 1793 }
@@ -1809,7 +1809,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1809 texface.RepeatU = (float)u; 1809 texface.RepeatU = (float)u;
1810 texface.RepeatV = (float)v; 1810 texface.RepeatV = (float)v;
1811 tex.FaceTextures[face] = texface; 1811 tex.FaceTextures[face] = texface;
1812 part.UpdateTexture(tex); 1812 part.UpdateTextureEntry(tex.GetBytes());
1813 return; 1813 return;
1814 } 1814 }
1815 if (face == ScriptBaseClass.ALL_SIDES) 1815 if (face == ScriptBaseClass.ALL_SIDES)
@@ -1824,7 +1824,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1824 } 1824 }
1825 tex.DefaultTexture.RepeatU = (float)u; 1825 tex.DefaultTexture.RepeatU = (float)u;
1826 tex.DefaultTexture.RepeatV = (float)v; 1826 tex.DefaultTexture.RepeatV = (float)v;
1827 part.UpdateTexture(tex); 1827 part.UpdateTextureEntry(tex.GetBytes());
1828 return; 1828 return;
1829 } 1829 }
1830 } 1830 }
@@ -1845,7 +1845,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1845 texface.OffsetU = (float)u; 1845 texface.OffsetU = (float)u;
1846 texface.OffsetV = (float)v; 1846 texface.OffsetV = (float)v;
1847 tex.FaceTextures[face] = texface; 1847 tex.FaceTextures[face] = texface;
1848 part.UpdateTexture(tex); 1848 part.UpdateTextureEntry(tex.GetBytes());
1849 return; 1849 return;
1850 } 1850 }
1851 if (face == ScriptBaseClass.ALL_SIDES) 1851 if (face == ScriptBaseClass.ALL_SIDES)
@@ -1860,7 +1860,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1860 } 1860 }
1861 tex.DefaultTexture.OffsetU = (float)u; 1861 tex.DefaultTexture.OffsetU = (float)u;
1862 tex.DefaultTexture.OffsetV = (float)v; 1862 tex.DefaultTexture.OffsetV = (float)v;
1863 part.UpdateTexture(tex); 1863 part.UpdateTextureEntry(tex.GetBytes());
1864 return; 1864 return;
1865 } 1865 }
1866 } 1866 }
@@ -1880,7 +1880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1880 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); 1880 Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
1881 texface.Rotation = (float)rotation; 1881 texface.Rotation = (float)rotation;
1882 tex.FaceTextures[face] = texface; 1882 tex.FaceTextures[face] = texface;
1883 part.UpdateTexture(tex); 1883 part.UpdateTextureEntry(tex.GetBytes());
1884 return; 1884 return;
1885 } 1885 }
1886 if (face == ScriptBaseClass.ALL_SIDES) 1886 if (face == ScriptBaseClass.ALL_SIDES)
@@ -1893,7 +1893,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1893 } 1893 }
1894 } 1894 }
1895 tex.DefaultTexture.Rotation = (float)rotation; 1895 tex.DefaultTexture.Rotation = (float)rotation;
1896 part.UpdateTexture(tex); 1896 part.UpdateTextureEntry(tex.GetBytes());
1897 return; 1897 return;
1898 } 1898 }
1899 } 1899 }
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 63aabad..7a4ec57 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -358,7 +358,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
358 return null; 358 return null;
359 } 359 }
360 360
361 public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName) 361 public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName)
362 { 362 {
363 Hashtable hash = new Hashtable(); 363 Hashtable hash = new Hashtable();
364 hash["sessionID"] = sessionID.ToString(); 364 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 1559cf3..cdc560c 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;
49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; 49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
50using OpenSim.Services.Interfaces; 50using OpenSim.Services.Interfaces;
51using OpenSim.Tests.Common.Mock; 51using OpenSim.Tests.Common.Mock;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 53
53namespace OpenSim.Tests.Common 54namespace 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>
diff --git a/prebuild.xml b/prebuild.xml
index a7e3bde..4e36172 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3016,6 +3016,7 @@
3016 <Reference name="OpenSim.Framework.Servers"/> 3016 <Reference name="OpenSim.Framework.Servers"/>
3017 <Reference name="OpenSim.Framework.Statistics"/> 3017 <Reference name="OpenSim.Framework.Statistics"/>
3018 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3018 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3019 <Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
3019 <Reference name="OpenSim.Region.Framework"/> 3020 <Reference name="OpenSim.Region.Framework"/>
3020 <Reference name="OpenSim.Region.CoreModules"/> 3021 <Reference name="OpenSim.Region.CoreModules"/>
3021 <Reference name="OpenSim.Region.OptionalModules"/> 3022 <Reference name="OpenSim.Region.OptionalModules"/>