aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/SimClient.cs
diff options
context:
space:
mode:
authorMW2007-05-15 15:05:13 +0000
committerMW2007-05-15 15:05:13 +0000
commitdb6427b6f4709d86c5bf1e4711ff2be0f65e5875 (patch)
treeea9d6f366436594f543c1d5b50c522dcfdb3b5e4 /OpenSim.RegionServer/SimClient.cs
parentupdated Build/project files to include the new projects and new files. (diff)
downloadopensim-SC_OLD-db6427b6f4709d86c5bf1e4711ff2be0f65e5875.zip
opensim-SC_OLD-db6427b6f4709d86c5bf1e4711ff2be0f65e5875.tar.gz
opensim-SC_OLD-db6427b6f4709d86c5bf1e4711ff2be0f65e5875.tar.bz2
opensim-SC_OLD-db6427b6f4709d86c5bf1e4711ff2be0f65e5875.tar.xz
Turned SimClient into a partial class (and added SimClient(Grid), so that grid mode specific code can be kept separate)
Fixed the ServiceManager project (added reference to System.Xml to its project in prebuil.xml)
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/SimClient.cs124
1 files changed, 1 insertions, 123 deletions
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index 49221f8..03e151a 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -50,7 +50,7 @@ namespace OpenSim
50 /// Handles new client connections 50 /// Handles new client connections
51 /// Constructor takes a single Packet and authenticates everything 51 /// Constructor takes a single Packet and authenticates everything
52 /// </summary> 52 /// </summary>
53 public class SimClient 53 public partial class SimClient
54 { 54 {
55 public LLUUID AgentID; 55 public LLUUID AgentID;
56 public LLUUID SessionID; 56 public LLUUID SessionID;
@@ -142,82 +142,6 @@ namespace OpenSim
142 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); 142 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
143 } 143 }
144 144
145 public void CrossSimBorder(LLVector3 avatarpos)
146 { // VERY VERY BASIC
147
148 LLVector3 newpos = avatarpos;
149 uint neighbourx = this.m_regionData.RegionLocX;
150 uint neighboury = this.m_regionData.RegionLocY;
151
152 if (avatarpos.X < 0)
153 {
154 neighbourx -= 1;
155 newpos.X = 254;
156 }
157 if (avatarpos.X > 255)
158 {
159 neighbourx += 1;
160 newpos.X = 1;
161 }
162 if (avatarpos.Y < 0)
163 {
164 neighboury -= 1;
165 newpos.Y = 254;
166 }
167 if (avatarpos.Y > 255)
168 {
169 neighbourx += 1;
170 newpos.Y = 1;
171 }
172 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:CrossSimBorder() - Crossing border to neighbouring sim at [" + neighbourx.ToString() + "," + neighboury.ToString() + "]");
173
174 Hashtable SimParams;
175 ArrayList SendParams;
176 XmlRpcRequest GridReq;
177 XmlRpcResponse GridResp;
178 foreach (Hashtable borderingSim in ((RemoteGridBase)m_gridServer).neighbours)
179 {
180 if (((string)borderingSim["region_locx"]).Equals(neighbourx.ToString()) && ((string)borderingSim["region_locy"]).Equals(neighboury.ToString()))
181 {
182 SimParams = new Hashtable();
183 SimParams["firstname"] = this.ClientAvatar.firstname;
184 SimParams["lastname"] = this.ClientAvatar.lastname;
185 SimParams["circuit_code"] = this.CircuitCode.ToString();
186 SimParams["pos_x"] = newpos.X.ToString();
187 SimParams["pos_y"] = newpos.Y.ToString();
188 SimParams["pos_z"] = newpos.Z.ToString();
189 SendParams = new ArrayList();
190 SendParams.Add(SimParams);
191
192 GridReq = new XmlRpcRequest("agent_crossing", SendParams);
193 GridResp = GridReq.Send("http://" + borderingSim["sim_ip"] + ":" + borderingSim["sim_port"], 3000);
194
195 CrossedRegionPacket NewSimPack = new CrossedRegionPacket();
196 NewSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
197 NewSimPack.AgentData.AgentID = this.AgentID;
198 NewSimPack.AgentData.SessionID = this.SessionID;
199 NewSimPack.Info = new CrossedRegionPacket.InfoBlock();
200 NewSimPack.Info.Position = newpos;
201 NewSimPack.Info.LookAt = new LLVector3(0.99f, 0.042f, 0); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
202 NewSimPack.RegionData = new libsecondlife.Packets.CrossedRegionPacket.RegionDataBlock();
203 NewSimPack.RegionData.RegionHandle = Helpers.UIntsToLong((uint)(Convert.ToInt32(borderingSim["region_locx"]) * 256), (uint)(Convert.ToInt32(borderingSim["region_locy"]) * 256));
204 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)borderingSim["sim_ip"]);
205 byte[] byteIP = neighbourIP.GetAddressBytes();
206 NewSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
207 NewSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
208 NewSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
209 NewSimPack.RegionData.SimIP += (uint)byteIP[0];
210 NewSimPack.RegionData.SimPort = (ushort)Convert.ToInt32(borderingSim["sim_port"]);
211 NewSimPack.RegionData.SeedCapability = new byte[0];
212 lock (PacketQueue)
213 {
214 ProcessOutPacket(NewSimPack);
215 DowngradeClient();
216 }
217 }
218 }
219 }
220
221 public void UpgradeClient() 145 public void UpgradeClient()
222 { 146 {
223 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - upgrading child to full agent"); 147 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - upgrading child to full agent");
@@ -1227,51 +1151,5 @@ namespace OpenSim
1227 1151
1228 //now should get other regions maps from gridserver 1152 //now should get other regions maps from gridserver
1229 } 1153 }
1230
1231 public void EnableNeighbours()
1232 {
1233 if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child))
1234 {
1235 Hashtable SimParams;
1236 ArrayList SendParams;
1237 XmlRpcRequest GridReq;
1238 XmlRpcResponse GridResp;
1239 List<Packet> enablePackets = new List<Packet>();
1240 foreach (Hashtable neighbour in ((RemoteGridBase)this.m_gridServer).neighbours)
1241 {
1242 Console.WriteLine( "http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
1243 SimParams = new Hashtable();
1244 SimParams["session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SessionID.ToString();
1245 SimParams["secure_session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SecureSessionID.ToString();
1246 SimParams["firstname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].firstname;
1247 SimParams["lastname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].lastname;
1248 SimParams["agent_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].AgentID.ToString();
1249 SimParams["circuit_code"] = (Int32)this.CircuitCode;
1250 SimParams["child_agent"] = "1";
1251 SendParams = new ArrayList();
1252 SendParams.Add(SimParams);
1253
1254 GridReq = new XmlRpcRequest("expect_user", SendParams);
1255 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
1256 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
1257 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
1258 enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
1259 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
1260 byte[] byteIP = neighbourIP.GetAddressBytes();
1261 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
1262 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
1263 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
1264 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
1265 enablesimpacket.SimulatorInfo.Port = (ushort)Convert.ToInt32(neighbour["sim_port"]);
1266 enablePackets.Add(enablesimpacket);
1267 }
1268 Thread.Sleep(3000);
1269 foreach (Packet enable in enablePackets)
1270 {
1271 this.OutPacket(enable);
1272 }
1273 enablePackets.Clear();
1274 }
1275 }
1276 } 1154 }
1277} 1155}