aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs16
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs6
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs80
3 files changed, 59 insertions, 43 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 1aa3282..8ab323a 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -158,10 +158,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
158 try 158 try
159 { 159 {
160 WebClient c = new WebClient(); 160 WebClient c = new WebClient();
161 //m_log.Debug("JPEG: " + imageURL);
162 string name = regionID.ToString(); 161 string name = regionID.ToString();
163 filename = Path.Combine(storagePath, name + ".jpg"); 162 filename = Path.Combine(storagePath, name + ".jpg");
164 c.DownloadFile(imageURL, filename); 163 m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename);
164 if (!File.Exists(filename))
165 {
166 m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading...");
167 c.DownloadFile(imageURL, filename);
168 }
169 else
170 m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
171
165 bitmap = new Bitmap(filename); 172 bitmap = new Bitmap(filename);
166 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); 173 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
167 byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true); 174 byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
@@ -172,10 +179,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
172 179
173 ass.Data = imageData; 180 ass.Data = imageData;
174 181
175 m_AssetService.Store(ass); 182 mapTile = ass.FullID;
176 183
177 // finally 184 // finally
178 mapTile = ass.FullID; 185 m_AssetService.Store(ass);
186
179 } 187 }
180 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke 188 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
181 { 189 {
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 7ddcfa6..c40a347 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -60,7 +60,9 @@ namespace OpenSim.Services.Connectors.Hypergrid
60 { 60 {
61 Uri m_Uri = new Uri(m_ServerURL); 61 Uri m_Uri = new Uri(m_ServerURL);
62 IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); 62 IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
63 m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ; 63 m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString());
64 if (!m_ServerURL.EndsWith("/"))
65 m_ServerURL += "/";
64 } 66 }
65 catch (Exception e) 67 catch (Exception e)
66 { 68 {
@@ -87,6 +89,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
87 throw new Exception("UserAgent connector init error"); 89 throw new Exception("UserAgent connector init error");
88 } 90 }
89 m_ServerURL = serviceURI; 91 m_ServerURL = serviceURI;
92 if (!m_ServerURL.EndsWith("/"))
93 m_ServerURL += "/";
90 94
91 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); 95 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
92 } 96 }
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index c02c813..588c1dd 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -162,6 +162,7 @@ namespace OpenSim.Services.GridService
162 162
163 #region Link Region 163 #region Link Region
164 164
165 // from map search
165 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 166 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
166 { 167 {
167 string reason = string.Empty; 168 string reason = string.Empty;
@@ -171,7 +172,7 @@ namespace OpenSim.Services.GridService
171 172
172 private static Random random = new Random(); 173 private static Random random = new Random();
173 174
174 // From the command line link-region 175 // From the command line link-region (obsolete) and the map
175 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 176 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
176 { 177 {
177 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 178 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -180,45 +181,48 @@ namespace OpenSim.Services.GridService
180 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 181 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
181 { 182 {
182 reason = string.Empty; 183 reason = string.Empty;
183 string host = "127.0.0.1"; 184 GridRegion regInfo = null;
184 string portstr; 185
185 string regionName = ""; 186 if (!mapName.StartsWith("http"))
186 uint port = 0;
187 string[] parts = mapName.Split(new char[] { ':' });
188 if (parts.Length >= 1)
189 {
190 host = parts[0];
191 }
192 if (parts.Length >= 2)
193 {
194 portstr = parts[1];
195 //m_log.Debug("-- port = " + portstr);
196 if (!UInt32.TryParse(portstr, out port))
197 regionName = parts[1];
198 }
199 // always take the last one
200 if (parts.Length >= 3)
201 { 187 {
202 regionName = parts[2]; 188 string host = "127.0.0.1";
203 } 189 string portstr;
190 string regionName = "";
191 uint port = 0;
192 string[] parts = mapName.Split(new char[] { ':' });
193 if (parts.Length >= 1)
194 {
195 host = parts[0];
196 }
197 if (parts.Length >= 2)
198 {
199 portstr = parts[1];
200 //m_log.Debug("-- port = " + portstr);
201 if (!UInt32.TryParse(portstr, out port))
202 regionName = parts[1];
203 }
204 // always take the last one
205 if (parts.Length >= 3)
206 {
207 regionName = parts[2];
208 }
204 209
205 //// Sanity check.
206 //try
207 //{
208 // Util.GetHostFromDNS(host);
209 //}
210 //catch
211 //{
212 // reason = "Malformed hostname";
213 // return null;
214 //}
215 210
216 GridRegion regInfo; 211 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
217 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); 212 if (success)
218 if (success) 213 {
214 regInfo.RegionName = mapName;
215 return regInfo;
216 }
217 }
218 else
219 { 219 {
220 regInfo.RegionName = mapName; 220 string[] parts = mapName.Split(new char[] {' '});
221 return regInfo; 221 string regionName = String.Empty;
222 if (parts.Length > 1)
223 regionName = parts[1];
224 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
225 return regInfo;
222 } 226 }
223 227
224 return null; 228 return null;
@@ -231,7 +235,7 @@ namespace OpenSim.Services.GridService
231 235
232 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) 236 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
233 { 237 {
234 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", 238 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}",
235 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 239 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
236 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 240 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
237 241
@@ -324,7 +328,7 @@ namespace OpenSim.Services.GridService
324 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); 328 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory);
325 329
326 AddHyperlinkRegion(regInfo, handle); 330 AddHyperlinkRegion(regInfo, handle);
327 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); 331 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage);
328 return true; 332 return true;
329 } 333 }
330 334