diff options
author | Melanie | 2009-09-21 18:12:12 +0100 |
---|---|---|
committer | Melanie | 2009-09-21 18:12:12 +0100 |
commit | 5511c62580c09cf98a1f2d717b478cc0f1881a6d (patch) | |
tree | 95a5d36141ee39d25eba76105a4780a9536f0e8d /OpenSim/Services/GridService | |
parent | Add a RequestID (UUID.Random()) to the PollRequest and pass it to all (diff) | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-5511c62580c09cf98a1f2d717b478cc0f1881a6d.zip opensim-SC-5511c62580c09cf98a1f2d717b478cc0f1881a6d.tar.gz opensim-SC-5511c62580c09cf98a1f2d717b478cc0f1881a6d.tar.bz2 opensim-SC-5511c62580c09cf98a1f2d717b478cc0f1881a6d.tar.xz |
Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 65 | ||||
-rw-r--r-- | OpenSim/Services/GridService/GridServiceBase.cs | 22 |
2 files changed, 22 insertions, 65 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 6aa1c4f..2229421 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -88,13 +88,18 @@ namespace OpenSim.Services.GridService | |||
88 | return m_Database.Delete(regionID); | 88 | return m_Database.Delete(regionID); |
89 | } | 89 | } |
90 | 90 | ||
91 | public List<SimpleRegionInfo> GetNeighbours(UUID scopeID, int x, int y) | 91 | public List<SimpleRegionInfo> GetNeighbours(UUID scopeID, UUID regionID) |
92 | { | 92 | { |
93 | List<RegionData> rdatas = m_Database.Get(x - 1, y - 1, x + 1, y + 1, scopeID); | ||
94 | List<SimpleRegionInfo> rinfos = new List<SimpleRegionInfo>(); | 93 | List<SimpleRegionInfo> rinfos = new List<SimpleRegionInfo>(); |
95 | foreach (RegionData rdata in rdatas) | 94 | RegionData region = m_Database.Get(regionID, scopeID); |
96 | rinfos.Add(RegionData2RegionInfo(rdata)); | 95 | if (region != null) |
96 | { | ||
97 | // Not really? Maybe? | ||
98 | List<RegionData> rdatas = m_Database.Get(region.posX - 1, region.posY - 1, region.posX + 1, region.posY + 1, scopeID); | ||
99 | foreach (RegionData rdata in rdatas) | ||
100 | rinfos.Add(RegionData2RegionInfo(rdata)); | ||
97 | 101 | ||
102 | } | ||
98 | return rinfos; | 103 | return rinfos; |
99 | } | 104 | } |
100 | 105 | ||
@@ -164,68 +169,20 @@ namespace OpenSim.Services.GridService | |||
164 | rdata.posX = (int)rinfo.RegionLocX; | 169 | rdata.posX = (int)rinfo.RegionLocX; |
165 | rdata.posY = (int)rinfo.RegionLocY; | 170 | rdata.posY = (int)rinfo.RegionLocY; |
166 | rdata.RegionID = rinfo.RegionID; | 171 | rdata.RegionID = rinfo.RegionID; |
172 | rdata.Data = rinfo.ToKeyValuePairs(); | ||
167 | //rdata.RegionName = rinfo.RegionName; | 173 | //rdata.RegionName = rinfo.RegionName; |
168 | rdata.Data["external_ip_address"] = rinfo.ExternalEndPoint.Address.ToString(); | ||
169 | rdata.Data["external_port"] = rinfo.ExternalEndPoint.Port.ToString(); | ||
170 | rdata.Data["external_host_name"] = rinfo.ExternalHostName; | ||
171 | rdata.Data["http_port"] = rinfo.HttpPort.ToString(); | ||
172 | rdata.Data["internal_ip_address"] = rinfo.InternalEndPoint.Address.ToString(); | ||
173 | rdata.Data["internal_port"] = rinfo.InternalEndPoint.Port.ToString(); | ||
174 | rdata.Data["alternate_ports"] = rinfo.m_allow_alternate_ports.ToString(); | ||
175 | rdata.Data["server_uri"] = rinfo.ServerURI; | ||
176 | 174 | ||
177 | return rdata; | 175 | return rdata; |
178 | } | 176 | } |
179 | 177 | ||
180 | protected SimpleRegionInfo RegionData2RegionInfo(RegionData rdata) | 178 | protected SimpleRegionInfo RegionData2RegionInfo(RegionData rdata) |
181 | { | 179 | { |
182 | SimpleRegionInfo rinfo = new SimpleRegionInfo(); | 180 | SimpleRegionInfo rinfo = new SimpleRegionInfo(rdata.Data); |
183 | rinfo.RegionLocX = (uint)rdata.posX; | 181 | rinfo.RegionLocX = (uint)rdata.posX; |
184 | rinfo.RegionLocY = (uint)rdata.posY; | 182 | rinfo.RegionLocY = (uint)rdata.posY; |
185 | rinfo.RegionID = rdata.RegionID; | 183 | rinfo.RegionID = rdata.RegionID; |
186 | //rinfo.RegionName = rdata.RegionName; | 184 | //rinfo.RegionName = rdata.RegionName; |
187 | 185 | ||
188 | // Now for the variable data | ||
189 | if ((rdata.Data["external_ip_address"] != null) && (rdata.Data["external_port"] != null)) | ||
190 | { | ||
191 | int port = 0; | ||
192 | Int32.TryParse((string)rdata.Data["external_port"], out port); | ||
193 | IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)rdata.Data["external_ip_address"]), port); | ||
194 | rinfo.ExternalEndPoint = ep; | ||
195 | } | ||
196 | else | ||
197 | rinfo.ExternalEndPoint = new IPEndPoint(new IPAddress(0), 0); | ||
198 | |||
199 | if (rdata.Data["external_host_name"] != null) | ||
200 | rinfo.ExternalHostName = (string)rdata.Data["external_host_name"] ; | ||
201 | |||
202 | if (rdata.Data["http_port"] != null) | ||
203 | { | ||
204 | UInt32 port = 0; | ||
205 | UInt32.TryParse((string)rdata.Data["http_port"], out port); | ||
206 | rinfo.HttpPort = port; | ||
207 | } | ||
208 | |||
209 | if ((rdata.Data["internal_ip_address"] != null) && (rdata.Data["internal_port"] != null)) | ||
210 | { | ||
211 | int port = 0; | ||
212 | Int32.TryParse((string)rdata.Data["internal_port"], out port); | ||
213 | IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)rdata.Data["internal_ip_address"]), port); | ||
214 | rinfo.InternalEndPoint = ep; | ||
215 | } | ||
216 | else | ||
217 | rinfo.InternalEndPoint = new IPEndPoint(new IPAddress(0), 0); | ||
218 | |||
219 | if (rdata.Data["alternate_ports"] != null) | ||
220 | { | ||
221 | bool alts = false; | ||
222 | Boolean.TryParse((string)rdata.Data["alternate_ports"], out alts); | ||
223 | rinfo.m_allow_alternate_ports = alts; | ||
224 | } | ||
225 | |||
226 | if (rdata.Data["server_uri"] != null) | ||
227 | rinfo.ServerURI = (string)rdata.Data["server_uri"]; | ||
228 | |||
229 | return rinfo; | 186 | return rinfo; |
230 | } | 187 | } |
231 | 188 | ||
diff --git a/OpenSim/Services/GridService/GridServiceBase.cs b/OpenSim/Services/GridService/GridServiceBase.cs index 7b69290..7522e64 100644 --- a/OpenSim/Services/GridService/GridServiceBase.cs +++ b/OpenSim/Services/GridService/GridServiceBase.cs | |||
@@ -47,17 +47,6 @@ namespace OpenSim.Services.GridService | |||
47 | string realm = "regions"; | 47 | string realm = "regions"; |
48 | 48 | ||
49 | // | 49 | // |
50 | // Try reading the [AssetService] section first, if it exists | ||
51 | // | ||
52 | IConfig gridConfig = config.Configs["GridService"]; | ||
53 | if (gridConfig != null) | ||
54 | { | ||
55 | dllName = gridConfig.GetString("StorageProvider", dllName); | ||
56 | connString = gridConfig.GetString("ConnectionString", connString); | ||
57 | realm = gridConfig.GetString("Realm", realm); | ||
58 | } | ||
59 | |||
60 | // | ||
61 | // Try reading the [DatabaseService] section, if it exists | 50 | // Try reading the [DatabaseService] section, if it exists |
62 | // | 51 | // |
63 | IConfig dbConfig = config.Configs["DatabaseService"]; | 52 | IConfig dbConfig = config.Configs["DatabaseService"]; |
@@ -70,6 +59,17 @@ namespace OpenSim.Services.GridService | |||
70 | } | 59 | } |
71 | 60 | ||
72 | // | 61 | // |
62 | // [GridService] section overrides [DatabaseService], if it exists | ||
63 | // | ||
64 | IConfig gridConfig = config.Configs["GridService"]; | ||
65 | if (gridConfig != null) | ||
66 | { | ||
67 | dllName = gridConfig.GetString("StorageProvider", dllName); | ||
68 | connString = gridConfig.GetString("ConnectionString", connString); | ||
69 | realm = gridConfig.GetString("Realm", realm); | ||
70 | } | ||
71 | |||
72 | // | ||
73 | // We tried, but this doesn't exist. We can't proceed. | 73 | // We tried, but this doesn't exist. We can't proceed. |
74 | // | 74 | // |
75 | if (dllName.Equals(String.Empty)) | 75 | if (dllName.Equals(String.Empty)) |