diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/RegionInfo.cs | 104 |
1 files changed, 41 insertions, 63 deletions
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs index cf0c075..e120198 100644 --- a/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim.RegionServer/RegionInfo.cs | |||
@@ -1,6 +1,9 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.Net; | ||
5 | using System.Web; | ||
6 | using System.IO; | ||
4 | using OpenSim.Framework.Interfaces; | 7 | using OpenSim.Framework.Interfaces; |
5 | using OpenSim.Framework.Utilities; | 8 | using OpenSim.Framework.Utilities; |
6 | using libsecondlife; | 9 | using libsecondlife; |
@@ -34,7 +37,37 @@ namespace OpenSim | |||
34 | public RegionInfo() | 37 | public RegionInfo() |
35 | { | 38 | { |
36 | 39 | ||
37 | } | 40 | } |
41 | |||
42 | public void SaveToGrid() | ||
43 | { | ||
44 | string reqtext; | ||
45 | reqtext="<authkey>" + this.GridSendKey + "</authkey>"; | ||
46 | reqtext+="<sim>"; | ||
47 | reqtext+="<uuid>" + this.SimUUID.ToString() + "</uuid>"; | ||
48 | reqtext+="<regionname>" + this.RegionName + "</regionname>"; | ||
49 | reqtext+="<sim_ip>" + this.IPListenAddr + "</sim_ip>"; | ||
50 | reqtext+="<sim_port>" + this.IPListenPort.ToString() + "</sim_port>"; | ||
51 | reqtext+="<region_locx>" + this.RegionLocX.ToString() + "</region_locx>"; | ||
52 | reqtext+="<region_locy>" + this.RegionLocY.ToString() + "</region_locy>"; | ||
53 | reqtext+="<estate_id>1</estate_id>"; | ||
54 | reqtext+="</sim>"; | ||
55 | |||
56 | WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString()); | ||
57 | GridSaveReq.Method = "POST"; | ||
58 | GridSaveReq.ContentType = "text/plaintext"; | ||
59 | GridSaveReq.ContentLength = reqtext.Length; | ||
60 | |||
61 | StreamWriter stOut = new StreamWriter(GridSaveReq.GetRequestStream(), System.Text.Encoding.ASCII); | ||
62 | stOut.Write(reqtext); | ||
63 | stOut.Close(); | ||
64 | |||
65 | StreamReader stIn = new StreamReader(GridSaveReq.GetResponse().GetResponseStream()); | ||
66 | string GridResponse = stIn.ReadToEnd(); | ||
67 | stIn.Close(); | ||
68 | |||
69 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse); | ||
70 | } | ||
38 | 71 | ||
39 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | 72 | public void InitConfig(bool sandboxMode, IGenericConfig configData) |
40 | { | 73 | { |
@@ -122,31 +155,7 @@ namespace OpenSim | |||
122 | { | 155 | { |
123 | //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object | 156 | //shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object |
124 | 157 | ||
125 | // Asset Server URL | 158 | //Grid Server URL |
126 | attri = ""; | ||
127 | attri = configData.GetAttribute("AssetServerURL"); | ||
128 | if (attri == "") | ||
129 | { | ||
130 | this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL: "); | ||
131 | configData.SetAttribute("AssetServerURL", this.AssetURL); | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | this.AssetURL = attri; | ||
136 | } | ||
137 | //Asset Server key | ||
138 | attri = ""; | ||
139 | attri = configData.GetAttribute("AssetServerKey"); | ||
140 | if (attri == "") | ||
141 | { | ||
142 | this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server key: "); | ||
143 | configData.SetAttribute("AssetServerKey", this.AssetSendKey); | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | this.AssetSendKey = attri; | ||
148 | } | ||
149 | //Grid Sever URL | ||
150 | attri = ""; | 159 | attri = ""; |
151 | attri = configData.GetAttribute("GridServerURL"); | 160 | attri = configData.GetAttribute("GridServerURL"); |
152 | if (attri == "") | 161 | if (attri == "") |
@@ -158,6 +167,7 @@ namespace OpenSim | |||
158 | { | 167 | { |
159 | this.GridURL = attri; | 168 | this.GridURL = attri; |
160 | } | 169 | } |
170 | |||
161 | //Grid Send Key | 171 | //Grid Send Key |
162 | attri = ""; | 172 | attri = ""; |
163 | attri = configData.GetAttribute("GridSendKey"); | 173 | attri = configData.GetAttribute("GridSendKey"); |
@@ -170,6 +180,7 @@ namespace OpenSim | |||
170 | { | 180 | { |
171 | this.GridSendKey = attri; | 181 | this.GridSendKey = attri; |
172 | } | 182 | } |
183 | |||
173 | //Grid Receive Key | 184 | //Grid Receive Key |
174 | attri = ""; | 185 | attri = ""; |
175 | attri = configData.GetAttribute("GridRecvKey"); | 186 | attri = configData.GetAttribute("GridRecvKey"); |
@@ -181,45 +192,12 @@ namespace OpenSim | |||
181 | else | 192 | else |
182 | { | 193 | { |
183 | this.GridRecvKey = attri; | 194 | this.GridRecvKey = attri; |
184 | } | 195 | } |
185 | //User Server URL | 196 | |
186 | attri = ""; | 197 | |
187 | attri = configData.GetAttribute("UserServerURL"); | ||
188 | if (attri == "") | ||
189 | { | ||
190 | this.UserURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("User server URL: "); | ||
191 | configData.SetAttribute("UserServerURL", this.UserURL); | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | this.UserURL = attri; | ||
196 | } | ||
197 | //User Send Key | ||
198 | attri = ""; | ||
199 | attri = configData.GetAttribute("UserSendKey"); | ||
200 | if (attri == "") | ||
201 | { | ||
202 | this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server: "); | ||
203 | configData.SetAttribute("UserSendKey", this.UserSendKey); | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | this.UserSendKey = attri; | ||
208 | } | ||
209 | //User Receive Key | ||
210 | attri = ""; | ||
211 | attri = configData.GetAttribute("UserRecvKey"); | ||
212 | if (attri == "") | ||
213 | { | ||
214 | this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server: "); | ||
215 | configData.SetAttribute("UserRecvKey", this.UserRecvKey); | ||
216 | } | ||
217 | else | ||
218 | { | ||
219 | this.UserRecvKey = attri; | ||
220 | } | ||
221 | } | 198 | } |
222 | this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | 199 | this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); |
200 | this.SaveToGrid(); | ||
223 | configData.Commit(); | 201 | configData.Commit(); |
224 | } | 202 | } |
225 | catch (Exception e) | 203 | catch (Exception e) |