aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/RegionInfo.cs83
1 files changed, 44 insertions, 39 deletions
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs
index e120198..83c69ff 100644
--- a/OpenSim.RegionServer/RegionInfo.cs
+++ b/OpenSim.RegionServer/RegionInfo.cs
@@ -1,9 +1,9 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Net; 4using System.Net;
5using System.Web; 5using System.Web;
6using System.IO; 6using System.IO;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Utilities; 8using OpenSim.Framework.Utilities;
9using libsecondlife; 9using libsecondlife;
@@ -37,37 +37,39 @@ namespace OpenSim
37 public RegionInfo() 37 public RegionInfo()
38 { 38 {
39 39
40 } 40 }
41 41
42 public void SaveToGrid() 42 public void SaveToGrid()
43 { 43 {
44 string reqtext; 44 //we really want to keep any server connection code out of here and out of the code code
45 reqtext="<authkey>" + this.GridSendKey + "</authkey>"; 45 // and put it in the server connection classes (those inheriting from IGridServer etc)
46 reqtext+="<sim>"; 46 string reqtext;
47 reqtext+="<uuid>" + this.SimUUID.ToString() + "</uuid>"; 47 reqtext = "<authkey>" + this.GridSendKey + "</authkey>";
48 reqtext+="<regionname>" + this.RegionName + "</regionname>"; 48 reqtext += "<sim>";
49 reqtext+="<sim_ip>" + this.IPListenAddr + "</sim_ip>"; 49 reqtext += "<uuid>" + this.SimUUID.ToString() + "</uuid>";
50 reqtext+="<sim_port>" + this.IPListenPort.ToString() + "</sim_port>"; 50 reqtext += "<regionname>" + this.RegionName + "</regionname>";
51 reqtext+="<region_locx>" + this.RegionLocX.ToString() + "</region_locx>"; 51 reqtext += "<sim_ip>" + this.IPListenAddr + "</sim_ip>";
52 reqtext+="<region_locy>" + this.RegionLocY.ToString() + "</region_locy>"; 52 reqtext += "<sim_port>" + this.IPListenPort.ToString() + "</sim_port>";
53 reqtext+="<estate_id>1</estate_id>"; 53 reqtext += "<region_locx>" + this.RegionLocX.ToString() + "</region_locx>";
54 reqtext+="</sim>"; 54 reqtext += "<region_locy>" + this.RegionLocY.ToString() + "</region_locy>";
55 55 reqtext += "<estate_id>1</estate_id>";
56 WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString()); 56 reqtext += "</sim>";
57 GridSaveReq.Method = "POST"; 57
58 GridSaveReq.ContentType = "text/plaintext"; 58 WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString());
59 GridSaveReq.ContentLength = reqtext.Length; 59 GridSaveReq.Method = "POST";
60 60 GridSaveReq.ContentType = "text/plaintext";
61 StreamWriter stOut = new StreamWriter(GridSaveReq.GetRequestStream(), System.Text.Encoding.ASCII); 61 GridSaveReq.ContentLength = reqtext.Length;
62 stOut.Write(reqtext); 62
63 stOut.Close(); 63 StreamWriter stOut = new StreamWriter(GridSaveReq.GetRequestStream(), System.Text.Encoding.ASCII);
64 64 stOut.Write(reqtext);
65 StreamReader stIn = new StreamReader(GridSaveReq.GetResponse().GetResponseStream()); 65 stOut.Close();
66 string GridResponse = stIn.ReadToEnd(); 66
67 stIn.Close(); 67 StreamReader stIn = new StreamReader(GridSaveReq.GetResponse().GetResponseStream());
68 68 string GridResponse = stIn.ReadToEnd();
69 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse); 69 stIn.Close();
70 } 70
71 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse);
72 }
71 73
72 public void InitConfig(bool sandboxMode, IGenericConfig configData) 74 public void InitConfig(bool sandboxMode, IGenericConfig configData)
73 { 75 {
@@ -167,7 +169,7 @@ namespace OpenSim
167 { 169 {
168 this.GridURL = attri; 170 this.GridURL = attri;
169 } 171 }
170 172
171 //Grid Send Key 173 //Grid Send Key
172 attri = ""; 174 attri = "";
173 attri = configData.GetAttribute("GridSendKey"); 175 attri = configData.GetAttribute("GridSendKey");
@@ -180,7 +182,7 @@ namespace OpenSim
180 { 182 {
181 this.GridSendKey = attri; 183 this.GridSendKey = attri;
182 } 184 }
183 185
184 //Grid Receive Key 186 //Grid Receive Key
185 attri = ""; 187 attri = "";
186 attri = configData.GetAttribute("GridRecvKey"); 188 attri = configData.GetAttribute("GridRecvKey");
@@ -192,12 +194,15 @@ namespace OpenSim
192 else 194 else
193 { 195 {
194 this.GridRecvKey = attri; 196 this.GridRecvKey = attri;
195 } 197 }
196 198
197 199
198 } 200 }
199 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); 201 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
200 this.SaveToGrid(); 202 if (!this.isSandbox)
203 {
204 this.SaveToGrid();
205 }
201 configData.Commit(); 206 configData.Commit();
202 } 207 }
203 catch (Exception e) 208 catch (Exception e)