diff options
author | Justin Clark-Casey (justincc) | 2009-09-25 19:19:01 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-25 19:19:01 +0100 |
commit | 0bdf75637ff67ee443fa5c4d335c76ca594c254a (patch) | |
tree | 52c546b2118101b7bb82ccc7dee273573c8fa0a2 /OpenSim/Services/GridService/GridService.cs | |
parent | Don't preserve full user profile details within iars for now (diff) | |
parent | More small changes to FlotsamAssetCache as per mcortez' request. (diff) | |
download | opensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.zip opensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.gz opensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.bz2 opensim-SC_OLD-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Services/GridService/GridService.cs')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 91 |
1 files changed, 11 insertions, 80 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 01ffa1d..991acf2 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -50,35 +50,27 @@ namespace OpenSim.Services.GridService | |||
50 | : base(config) | 50 | : base(config) |
51 | { | 51 | { |
52 | m_log.DebugFormat("[GRID SERVICE]: Starting..."); | 52 | m_log.DebugFormat("[GRID SERVICE]: Starting..."); |
53 | MainConsole.Instance.Commands.AddCommand("kfs", false, | ||
54 | "show digest", | ||
55 | "show digest <ID>", | ||
56 | "Show asset digest", HandleShowDigest); | ||
57 | |||
58 | MainConsole.Instance.Commands.AddCommand("kfs", false, | ||
59 | "delete asset", | ||
60 | "delete asset <ID>", | ||
61 | "Delete asset from database", HandleDeleteAsset); | ||
62 | |||
63 | } | 53 | } |
64 | 54 | ||
65 | #region IGridService | 55 | #region IGridService |
66 | 56 | ||
67 | public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) | 57 | public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) |
68 | { | 58 | { |
69 | if (m_Database.Get(regionInfos.RegionID, scopeID) != null) | ||
70 | { | ||
71 | m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID); | ||
72 | return false; | ||
73 | } | ||
74 | // This needs better sanity testing. What if regionInfo is registering in | 59 | // This needs better sanity testing. What if regionInfo is registering in |
75 | // overlapping coords? | 60 | // overlapping coords? |
76 | if (m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID) != null) | 61 | RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); |
62 | if ((region != null) && (region.RegionID != regionInfos.RegionID)) | ||
77 | { | 63 | { |
78 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", | 64 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", |
79 | regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | 65 | regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); |
80 | return false; | 66 | return false; |
81 | } | 67 | } |
68 | if ((region != null) && (region.RegionID == regionInfos.RegionID) && | ||
69 | ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) | ||
70 | { | ||
71 | // Region reregistering in other coordinates. Delete the old entry | ||
72 | m_Database.Delete(regionInfos.RegionID); | ||
73 | } | ||
82 | 74 | ||
83 | // Everything is ok, let's register | 75 | // Everything is ok, let's register |
84 | RegionData rdata = RegionInfo2RegionData(regionInfos); | 76 | RegionData rdata = RegionInfo2RegionData(regionInfos); |
@@ -183,9 +175,9 @@ namespace OpenSim.Services.GridService | |||
183 | rdata.posX = (int)rinfo.RegionLocX; | 175 | rdata.posX = (int)rinfo.RegionLocX; |
184 | rdata.posY = (int)rinfo.RegionLocY; | 176 | rdata.posY = (int)rinfo.RegionLocY; |
185 | rdata.RegionID = rinfo.RegionID; | 177 | rdata.RegionID = rinfo.RegionID; |
186 | rdata.Data = rinfo.ToKeyValuePairs(); | ||
187 | rdata.RegionName = rinfo.RegionName; | 178 | rdata.RegionName = rinfo.RegionName; |
188 | 179 | rdata.Data = rinfo.ToKeyValuePairs(); | |
180 | rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY); | ||
189 | return rdata; | 181 | return rdata; |
190 | } | 182 | } |
191 | 183 | ||
@@ -196,73 +188,12 @@ namespace OpenSim.Services.GridService | |||
196 | rinfo.RegionLocY = rdata.posY; | 188 | rinfo.RegionLocY = rdata.posY; |
197 | rinfo.RegionID = rdata.RegionID; | 189 | rinfo.RegionID = rdata.RegionID; |
198 | rinfo.RegionName = rdata.RegionName; | 190 | rinfo.RegionName = rdata.RegionName; |
191 | rinfo.ScopeID = rdata.ScopeID; | ||
199 | 192 | ||
200 | return rinfo; | 193 | return rinfo; |
201 | } | 194 | } |
202 | 195 | ||
203 | #endregion | 196 | #endregion |
204 | 197 | ||
205 | void HandleShowDigest(string module, string[] args) | ||
206 | { | ||
207 | //if (args.Length < 3) | ||
208 | //{ | ||
209 | // MainConsole.Instance.Output("Syntax: show digest <ID>"); | ||
210 | // return; | ||
211 | //} | ||
212 | |||
213 | //AssetBase asset = Get(args[2]); | ||
214 | |||
215 | //if (asset == null || asset.Data.Length == 0) | ||
216 | //{ | ||
217 | // MainConsole.Instance.Output("Asset not found"); | ||
218 | // return; | ||
219 | //} | ||
220 | |||
221 | //int i; | ||
222 | |||
223 | //MainConsole.Instance.Output(String.Format("Name: {0}", asset.Name)); | ||
224 | //MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description)); | ||
225 | //MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type)); | ||
226 | //MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType)); | ||
227 | |||
228 | //for (i = 0 ; i < 5 ; i++) | ||
229 | //{ | ||
230 | // int off = i * 16; | ||
231 | // if (asset.Data.Length <= off) | ||
232 | // break; | ||
233 | // int len = 16; | ||
234 | // if (asset.Data.Length < off + len) | ||
235 | // len = asset.Data.Length - off; | ||
236 | |||
237 | // byte[] line = new byte[len]; | ||
238 | // Array.Copy(asset.Data, off, line, 0, len); | ||
239 | |||
240 | // string text = BitConverter.ToString(line); | ||
241 | // MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text)); | ||
242 | //} | ||
243 | } | ||
244 | |||
245 | void HandleDeleteAsset(string module, string[] args) | ||
246 | { | ||
247 | //if (args.Length < 3) | ||
248 | //{ | ||
249 | // MainConsole.Instance.Output("Syntax: delete asset <ID>"); | ||
250 | // return; | ||
251 | //} | ||
252 | |||
253 | //AssetBase asset = Get(args[2]); | ||
254 | |||
255 | //if (asset == null || asset.Data.Length == 0) | ||
256 | // MainConsole.Instance.Output("Asset not found"); | ||
257 | // return; | ||
258 | //} | ||
259 | |||
260 | //Delete(args[2]); | ||
261 | |||
262 | ////MainConsole.Instance.Output("Asset deleted"); | ||
263 | //// TODO: Implement this | ||
264 | |||
265 | //MainConsole.Instance.Output("Asset deletion not supported by database"); | ||
266 | } | ||
267 | } | 198 | } |
268 | } | 199 | } |