diff options
author | Johan Berntsson | 2008-03-04 05:31:54 +0000 |
---|---|---|
committer | Johan Berntsson | 2008-03-04 05:31:54 +0000 |
commit | 279e0061c515ee0a03036bef68eea9738273d785 (patch) | |
tree | 4502228eb7b87a760e0b0e67aded9d1d870d0bed /OpenSim/Region | |
parent | Added copyright heaaders. Minor cleanup. (diff) | |
download | opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.zip opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.gz opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.bz2 opensim-SC_OLD-279e0061c515ee0a03036bef68eea9738273d785.tar.xz |
Merged 3Di code that provides scene and avatar serialization, and plugin support for region move/split/merge. See ThirdParty/3Di/README.txt. Unless the new modules are used there should be no noticeable changes when running OpenSim.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 152 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 145 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/PacketQueue.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/PacketServer.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/RegionApplicationBase.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/UDPServer.cs | 92 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/AvatarAppearance.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityBase.cs | 91 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 119 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 416 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Types/UpdateQueue.cs | 50 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 13 |
15 files changed, 1227 insertions, 57 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index bdefd0f..2c9e50e 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -33,8 +33,6 @@ using System.IO; | |||
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Threading; | 34 | using System.Threading; |
35 | using System.Timers; | 35 | using System.Timers; |
36 | using libsecondlife; | ||
37 | using Mono.Addins; | ||
38 | using Nini.Config; | 36 | using Nini.Config; |
39 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications.Cache; | 38 | using OpenSim.Framework.Communications.Cache; |
@@ -49,6 +47,13 @@ using OpenSim.Region.Environment.Interfaces; | |||
49 | using OpenSim.Region.Environment.Scenes; | 47 | using OpenSim.Region.Environment.Scenes; |
50 | using OpenSim.Region.Physics.Manager; | 48 | using OpenSim.Region.Physics.Manager; |
51 | using Timer=System.Timers.Timer; | 49 | using Timer=System.Timers.Timer; |
50 | using System.Net; | ||
51 | using Nwc.XmlRpc; | ||
52 | using System.Collections; | ||
53 | using System.Reflection; | ||
54 | using libsecondlife; | ||
55 | using Mono.Addins; | ||
56 | using Mono.Addins.Description; | ||
52 | 57 | ||
53 | namespace OpenSim | 58 | namespace OpenSim |
54 | { | 59 | { |
@@ -57,6 +62,8 @@ namespace OpenSim | |||
57 | public class OpenSimMain : RegionApplicationBase, conscmd_callback | 62 | public class OpenSimMain : RegionApplicationBase, conscmd_callback |
58 | { | 63 | { |
59 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 64 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
65 | private string proxyUrl; | ||
66 | private int proxyOffset = 0; | ||
60 | 67 | ||
61 | private const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; | 68 | private const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; |
62 | 69 | ||
@@ -110,6 +117,16 @@ namespace OpenSim | |||
110 | get { return m_httpServer; } | 117 | get { return m_httpServer; } |
111 | } | 118 | } |
112 | 119 | ||
120 | public List<UDPServer> UdpServers | ||
121 | { | ||
122 | get { return m_udpServers; } | ||
123 | } | ||
124 | |||
125 | public List<RegionInfo> RegionData | ||
126 | { | ||
127 | get { return m_regionData; } | ||
128 | } | ||
129 | |||
113 | private ModuleLoader m_moduleLoader; | 130 | private ModuleLoader m_moduleLoader; |
114 | 131 | ||
115 | public ModuleLoader ModuleLoader | 132 | public ModuleLoader ModuleLoader |
@@ -350,20 +367,34 @@ namespace OpenSim | |||
350 | m_httpServer.AddStreamHandler(new SimStatusHandler()); | 367 | m_httpServer.AddStreamHandler(new SimStatusHandler()); |
351 | } | 368 | } |
352 | 369 | ||
370 | proxyUrl = ConfigSource.Configs["Network"].GetString("proxy_url", ""); | ||
371 | proxyOffset = Int32.Parse(ConfigSource.Configs["Network"].GetString("proxy_offset", "0")); | ||
372 | |||
353 | // Create a ModuleLoader instance | 373 | // Create a ModuleLoader instance |
354 | m_moduleLoader = new ModuleLoader(m_config); | 374 | m_moduleLoader = new ModuleLoader(m_config); |
355 | 375 | ||
356 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); | 376 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); |
357 | m_log.InfoFormat("[PLUGINS]: Loading {0} OpenSim application plugins", nodes.Count); | 377 | m_log.InfoFormat("[PLUGINS]: Loading {0} OpenSim application plugins", nodes.Count); |
358 | |||
359 | foreach (TypeExtensionNode node in nodes) | 378 | foreach (TypeExtensionNode node in nodes) |
360 | { | 379 | { |
361 | IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance(); | 380 | // First load the proxy server (if present) |
362 | 381 | if(node.Path.Contains("Proxy")) | |
363 | plugin.Initialise(this); | 382 | { |
364 | m_plugins.Add(plugin); | 383 | IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance(); |
384 | plugin.Initialise(this); | ||
385 | m_plugins.Add(plugin); | ||
386 | } | ||
387 | } | ||
388 | // then load the other modules | ||
389 | foreach (TypeExtensionNode node in nodes) | ||
390 | { | ||
391 | if(!node.Path.Contains("Proxy")) | ||
392 | { | ||
393 | IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance(); | ||
394 | plugin.Initialise(this); | ||
395 | m_plugins.Add(plugin); | ||
396 | } | ||
365 | } | 397 | } |
366 | |||
367 | // Start UDP servers | 398 | // Start UDP servers |
368 | //for (int i = 0; i < m_udpServers.Count; i++) | 399 | //for (int i = 0; i < m_udpServers.Count; i++) |
369 | //{ | 400 | //{ |
@@ -436,10 +467,25 @@ namespace OpenSim | |||
436 | return m_commsManager.AddUser(tempfirstname,templastname,tempPasswd,regX,regY); | 467 | return m_commsManager.AddUser(tempfirstname,templastname,tempPasswd,regX,regY); |
437 | } | 468 | } |
438 | 469 | ||
439 | public UDPServer CreateRegion(RegionInfo regionInfo) | 470 | public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) |
440 | { | 471 | { |
472 | int port = regionInfo.InternalEndPoint.Port; | ||
473 | if ((proxyOffset != 0) && (portadd_flag)) | ||
474 | { | ||
475 | // set proxy url to RegionInfo | ||
476 | regionInfo.proxyUrl = proxyUrl; | ||
477 | |||
478 | // set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims) | ||
479 | regionInfo.originRegionID = regionInfo.RegionID; | ||
480 | |||
481 | // set initial ServerURI | ||
482 | regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName | ||
483 | + ":" + regionInfo.InternalEndPoint.Port.ToString(); | ||
484 | |||
485 | ProxyCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | ||
486 | } | ||
441 | UDPServer udpServer; | 487 | UDPServer udpServer; |
442 | Scene scene = SetupScene(regionInfo, out udpServer, m_permissions); | 488 | Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions); |
443 | 489 | ||
444 | m_log.Info("[MODULES]: Loading Region's modules"); | 490 | m_log.Info("[MODULES]: Loading Region's modules"); |
445 | 491 | ||
@@ -546,7 +592,7 @@ namespace OpenSim | |||
546 | m_regionData.RemoveAt(RegionHandleElement); | 592 | m_regionData.RemoveAt(RegionHandleElement); |
547 | } | 593 | } |
548 | 594 | ||
549 | CreateRegion(whichRegion); | 595 | CreateRegion(whichRegion, true); |
550 | //UDPServer restartingRegion = CreateRegion(whichRegion); | 596 | //UDPServer restartingRegion = CreateRegion(whichRegion); |
551 | //restartingRegion.ServerListener(); | 597 | //restartingRegion.ServerListener(); |
552 | //m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle); | 598 | //m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle); |
@@ -594,6 +640,8 @@ namespace OpenSim | |||
594 | /// </summary> | 640 | /// </summary> |
595 | public virtual void Shutdown() | 641 | public virtual void Shutdown() |
596 | { | 642 | { |
643 | ProxyCommand(proxyUrl, "Stop"); | ||
644 | |||
597 | if (m_startupCommandsFile != String.Empty) | 645 | if (m_startupCommandsFile != String.Empty) |
598 | { | 646 | { |
599 | RunCommandScript(m_shutdownCommandsFile); | 647 | RunCommandScript(m_shutdownCommandsFile); |
@@ -609,7 +657,7 @@ namespace OpenSim | |||
609 | 657 | ||
610 | m_console.Close(); | 658 | m_console.Close(); |
611 | Environment.Exit(0); | 659 | Environment.Exit(0); |
612 | } | 660 | } |
613 | 661 | ||
614 | private void RunAutoTimerScript(object sender, EventArgs e) | 662 | private void RunAutoTimerScript(object sender, EventArgs e) |
615 | { | 663 | { |
@@ -882,9 +930,8 @@ namespace OpenSim | |||
882 | break; | 930 | break; |
883 | 931 | ||
884 | case "create-region": | 932 | case "create-region": |
885 | CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false)); | 933 | CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false), true); |
886 | break; | 934 | break; |
887 | |||
888 | case "remove-region": | 935 | case "remove-region": |
889 | string regName = CombineParams(cmdparams, 0); | 936 | string regName = CombineParams(cmdparams, 0); |
890 | 937 | ||
@@ -1120,6 +1167,8 @@ namespace OpenSim | |||
1120 | presence.ControllingClient.CircuitCode, | 1167 | presence.ControllingClient.CircuitCode, |
1121 | ep, | 1168 | ep, |
1122 | regionName)); | 1169 | regionName)); |
1170 | m_console.Notice(" {0}", (((ClientView)presence.ControllingClient).PacketProcessingEnabled)?"Active client":"Standby client"); | ||
1171 | |||
1123 | } | 1172 | } |
1124 | 1173 | ||
1125 | break; | 1174 | break; |
@@ -1167,5 +1216,80 @@ namespace OpenSim | |||
1167 | } | 1216 | } |
1168 | 1217 | ||
1169 | #endregion | 1218 | #endregion |
1219 | // TODO: remove me!! (almost same as XmlRpcCommand) | ||
1220 | public object ProxyCommand(string url, string methodName, params object[] args) | ||
1221 | { | ||
1222 | if(proxyUrl.Length==0) return null; | ||
1223 | return SendXmlRpcCommand(url, methodName, args); | ||
1224 | } | ||
1225 | |||
1226 | public object XmlRpcCommand(uint port, string methodName, params object[] args) | ||
1227 | { | ||
1228 | return SendXmlRpcCommand("http://localhost:"+port, methodName, args); | ||
1229 | } | ||
1230 | |||
1231 | public object XmlRpcCommand(string url, string methodName, params object[] args) | ||
1232 | { | ||
1233 | return SendXmlRpcCommand(url, methodName, args); | ||
1234 | } | ||
1235 | |||
1236 | private object SendXmlRpcCommand(string url, string methodName, object[] args) | ||
1237 | { | ||
1238 | try { | ||
1239 | //MainLog.Instance.Verbose("XMLRPC", "Sending command {0} to {1}", methodName, url); | ||
1240 | XmlRpcRequest client = new XmlRpcRequest(methodName, args); | ||
1241 | //MainLog.Instance.Verbose("XMLRPC", client.ToString()); | ||
1242 | XmlRpcResponse response = client.Send(url, 6000); | ||
1243 | if(!response.IsFault) return response.Value; | ||
1244 | } | ||
1245 | catch(Exception e) | ||
1246 | { | ||
1247 | m_log.ErrorFormat("XMLRPC Failed to send command {0} to {1}: {2}", methodName, url, e.Message); | ||
1248 | } | ||
1249 | return null; | ||
1250 | } | ||
1251 | |||
1252 | /// <summary> | ||
1253 | /// Get the start time and up time of Region server | ||
1254 | /// </summary> | ||
1255 | /// <param name="starttime">The first out parameter describing when the Region server started</param> | ||
1256 | /// <param name="uptime">The second out parameter describing how long the Region server has run</param> | ||
1257 | public void GetRunTime(out string starttime, out string uptime) | ||
1258 | { | ||
1259 | starttime = m_startuptime.ToString(); | ||
1260 | uptime = (DateTime.Now - m_startuptime).ToString(); | ||
1261 | } | ||
1262 | |||
1263 | /// <summary> | ||
1264 | /// Get the number of the avatars in the Region server | ||
1265 | /// </summary> | ||
1266 | /// <param name="usernum">The first out parameter describing the number of all the avatars in the Region server</param> | ||
1267 | public void GetAvatarNumber(out int usernum) | ||
1268 | { | ||
1269 | int accounter = 0; | ||
1270 | |||
1271 | foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars()) { | ||
1272 | //presence.RegionHandle; | ||
1273 | accounter++; | ||
1274 | } | ||
1275 | |||
1276 | usernum = accounter; | ||
1277 | } | ||
1278 | |||
1279 | /// <summary> | ||
1280 | /// Get the number of the avatars in the Region server | ||
1281 | /// </summary> | ||
1282 | /// <param name="usernum">The first out parameter describing the number of all the avatars in the Region server</param> | ||
1283 | public void GetRegionNumber(out int regionnum) | ||
1284 | { | ||
1285 | int accounter = 0; | ||
1286 | //List<string> regionNameList = new List<string>(); | ||
1287 | |||
1288 | m_sceneManager.ForEachScene(delegate(Scene scene) { | ||
1289 | accounter++; | ||
1290 | }); | ||
1291 | regionnum = accounter; | ||
1292 | |||
1293 | } | ||
1170 | } | 1294 | } |
1171 | } | 1295 | } |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index b719086..b5cd6fb 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -61,6 +61,8 @@ namespace OpenSim.Region.ClientStack | |||
61 | /* static variables */ | 61 | /* static variables */ |
62 | public static TerrainManager TerrainManager; | 62 | public static TerrainManager TerrainManager; |
63 | 63 | ||
64 | public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, LLUUID agentID, ThrottleOutPacketType throttlePacketType); | ||
65 | public static SynchronizeClientHandler SynchronizeClient = null; | ||
64 | /* private variables */ | 66 | /* private variables */ |
65 | private readonly LLUUID m_sessionId; | 67 | private readonly LLUUID m_sessionId; |
66 | private LLUUID m_secureSessionId = LLUUID.Zero; | 68 | private LLUUID m_secureSessionId = LLUUID.Zero; |
@@ -118,6 +120,7 @@ namespace OpenSim.Region.ClientStack | |||
118 | protected Thread m_clientThread; | 120 | protected Thread m_clientThread; |
119 | protected LLVector3 m_startpos; | 121 | protected LLVector3 m_startpos; |
120 | protected EndPoint m_userEndPoint; | 122 | protected EndPoint m_userEndPoint; |
123 | protected EndPoint m_proxyEndPoint; | ||
121 | 124 | ||
122 | /* Instantiated Designated Event Delegates */ | 125 | /* Instantiated Designated Event Delegates */ |
123 | //- used so we don't create new objects for each incoming packet and then toss it out later */ | 126 | //- used so we don't create new objects for each incoming packet and then toss it out later */ |
@@ -291,7 +294,7 @@ namespace OpenSim.Region.ClientStack | |||
291 | /* METHODS */ | 294 | /* METHODS */ |
292 | 295 | ||
293 | public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer, | 296 | public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer, |
294 | AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode) | 297 | AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) |
295 | { | 298 | { |
296 | m_moneyBalance = 1000; | 299 | m_moneyBalance = 1000; |
297 | 300 | ||
@@ -311,6 +314,7 @@ namespace OpenSim.Region.ClientStack | |||
311 | m_circuitCode = circuitCode; | 314 | m_circuitCode = circuitCode; |
312 | 315 | ||
313 | m_userEndPoint = remoteEP; | 316 | m_userEndPoint = remoteEP; |
317 | m_proxyEndPoint = proxyEP; | ||
314 | 318 | ||
315 | m_startpos = m_authenticateSessionsHandler.GetPosition(circuitCode); | 319 | m_startpos = m_authenticateSessionsHandler.GetPosition(circuitCode); |
316 | 320 | ||
@@ -411,7 +415,37 @@ namespace OpenSim.Region.ClientStack | |||
411 | 415 | ||
412 | public void Stop() | 416 | public void Stop() |
413 | { | 417 | { |
414 | m_log.Info("[BUG]: Stop called, please find out where and remove it"); | 418 | // Shut down timers |
419 | m_ackTimer.Stop(); | ||
420 | m_clientPingTimer.Stop(); | ||
421 | } | ||
422 | |||
423 | public void Restart() | ||
424 | { | ||
425 | // re-construct | ||
426 | m_pendingAcks = new Dictionary<uint, uint>(); | ||
427 | m_needAck = new Dictionary<uint, Packet>(); | ||
428 | m_sequence += 1000000; | ||
429 | |||
430 | m_ackTimer = new Timer(750); | ||
431 | m_ackTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | ||
432 | m_ackTimer.Start(); | ||
433 | |||
434 | m_clientPingTimer = new Timer(5000); | ||
435 | m_clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | ||
436 | m_clientPingTimer.Enabled = true; | ||
437 | } | ||
438 | |||
439 | public void Terminate() | ||
440 | { | ||
441 | // disable blocking queue | ||
442 | m_packetQueue.Enqueue(null); | ||
443 | |||
444 | // wait for thread stoped | ||
445 | m_clientThread.Join(); | ||
446 | |||
447 | // delete circuit code | ||
448 | m_networkServer.CloseClient(this); | ||
415 | } | 449 | } |
416 | 450 | ||
417 | #endregion | 451 | #endregion |
@@ -507,6 +541,10 @@ namespace OpenSim.Region.ClientStack | |||
507 | while (true) | 541 | while (true) |
508 | { | 542 | { |
509 | QueItem nextPacket = m_packetQueue.Dequeue(); | 543 | QueItem nextPacket = m_packetQueue.Dequeue(); |
544 | if (nextPacket == null) | ||
545 | { | ||
546 | break; | ||
547 | } | ||
510 | if (nextPacket.Incoming) | 548 | if (nextPacket.Incoming) |
511 | { | 549 | { |
512 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) | 550 | if (nextPacket.Packet.Type != PacketType.AgentUpdate) |
@@ -2642,7 +2680,7 @@ namespace OpenSim.Region.ClientStack | |||
2642 | try | 2680 | try |
2643 | { | 2681 | { |
2644 | byte[] sendbuffer = Pack.ToBytes(); | 2682 | byte[] sendbuffer = Pack.ToBytes(); |
2645 | PacketPool.Instance.ReturnPacket(Pack); | 2683 | PacketPool.Instance.ReturnPacket(Pack); |
2646 | 2684 | ||
2647 | if (Pack.Header.Zerocoded) | 2685 | if (Pack.Header.Zerocoded) |
2648 | { | 2686 | { |
@@ -2651,8 +2689,11 @@ namespace OpenSim.Region.ClientStack | |||
2651 | } | 2689 | } |
2652 | else | 2690 | else |
2653 | { | 2691 | { |
2654 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); | 2692 | //Need some extra space in case we need to add proxy information to the message later |
2693 | Buffer.BlockCopy(sendbuffer, 0, ZeroOutBuffer, 0, sendbuffer.Length); | ||
2694 | m_networkServer.SendPacketTo(ZeroOutBuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); | ||
2655 | } | 2695 | } |
2696 | |||
2656 | } | 2697 | } |
2657 | catch (Exception e) | 2698 | catch (Exception e) |
2658 | { | 2699 | { |
@@ -2666,6 +2707,12 @@ namespace OpenSim.Region.ClientStack | |||
2666 | 2707 | ||
2667 | public virtual void InPacket(Packet NewPack) | 2708 | public virtual void InPacket(Packet NewPack) |
2668 | { | 2709 | { |
2710 | if(!m_packetProcessingEnabled && NewPack.Type != PacketType.LogoutRequest) | ||
2711 | { | ||
2712 | PacketPool.Instance.ReturnPacket(NewPack); | ||
2713 | return; | ||
2714 | } | ||
2715 | |||
2669 | // Handle appended ACKs | 2716 | // Handle appended ACKs |
2670 | if (NewPack != null) | 2717 | if (NewPack != null) |
2671 | { | 2718 | { |
@@ -2726,6 +2773,15 @@ namespace OpenSim.Region.ClientStack | |||
2726 | 2773 | ||
2727 | public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType) | 2774 | public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType) |
2728 | { | 2775 | { |
2776 | if ((SynchronizeClient != null) && (!PacketProcessingEnabled)) | ||
2777 | { | ||
2778 | // Sending packet to active client's server. | ||
2779 | if (SynchronizeClient(m_scene, NewPack, m_agentId, throttlePacketType)) | ||
2780 | { | ||
2781 | return; | ||
2782 | } | ||
2783 | } | ||
2784 | |||
2729 | QueItem item = new QueItem(); | 2785 | QueItem item = new QueItem(); |
2730 | item.Packet = NewPack; | 2786 | item.Packet = NewPack; |
2731 | item.Incoming = false; | 2787 | item.Incoming = false; |
@@ -2853,6 +2909,13 @@ namespace OpenSim.Region.ClientStack | |||
2853 | } | 2909 | } |
2854 | } | 2910 | } |
2855 | 2911 | ||
2912 | private bool m_packetProcessingEnabled = true; | ||
2913 | |||
2914 | public bool PacketProcessingEnabled { | ||
2915 | get { return m_packetProcessingEnabled; } | ||
2916 | set { m_packetProcessingEnabled = value; } | ||
2917 | } | ||
2918 | |||
2856 | protected void ProcessInPacket(Packet Pack) | 2919 | protected void ProcessInPacket(Packet Pack) |
2857 | { | 2920 | { |
2858 | ack_pack(Pack); | 2921 | ack_pack(Pack); |
@@ -4373,5 +4436,79 @@ namespace OpenSim.Region.ClientStack | |||
4373 | 4436 | ||
4374 | OutPacket(logReply, ThrottleOutPacketType.Task); | 4437 | OutPacket(logReply, ThrottleOutPacketType.Task); |
4375 | } | 4438 | } |
4439 | |||
4440 | public ClientInfo GetClientInfo() | ||
4441 | { | ||
4442 | //MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN"); | ||
4443 | |||
4444 | ClientInfo info = new ClientInfo(); | ||
4445 | info.userEP = this.m_userEndPoint; | ||
4446 | info.proxyEP = this.m_proxyEndPoint; | ||
4447 | info.agentcircuit = new sAgentCircuitData(RequestClientInfo()); | ||
4448 | |||
4449 | info.pendingAcks = m_pendingAcks; | ||
4450 | |||
4451 | info.needAck = new Dictionary<uint,byte[]>(); | ||
4452 | |||
4453 | lock (m_needAck) | ||
4454 | { | ||
4455 | foreach (uint key in m_needAck.Keys) | ||
4456 | { | ||
4457 | info.needAck.Add(key, m_needAck[key].ToBytes()); | ||
4458 | } | ||
4459 | } | ||
4460 | |||
4461 | /* pending | ||
4462 | QueItem[] queitems = m_packetQueue.GetQueueArray(); | ||
4463 | |||
4464 | MainLog.Instance.Verbose("CLIENT", "Queue Count : [{0}]", queitems.Length); | ||
4465 | |||
4466 | for (int i = 0; i < queitems.Length; i++) | ||
4467 | { | ||
4468 | if (queitems[i].Incoming == false) | ||
4469 | { | ||
4470 | info.out_packets.Add(queitems[i].Packet.ToBytes()); | ||
4471 | MainLog.Instance.Verbose("CLIENT", "Add OutPacket [{0}]", queitems[i].Packet.Type.ToString()); | ||
4472 | } | ||
4473 | } | ||
4474 | */ | ||
4475 | |||
4476 | info.sequence = m_sequence; | ||
4477 | |||
4478 | //MainLog.Instance.Verbose("CLIENT", "GetClientInfo END"); | ||
4479 | |||
4480 | return info; | ||
4481 | } | ||
4482 | |||
4483 | public void SetClientInfo(ClientInfo info) | ||
4484 | { | ||
4485 | m_pendingAcks = info.pendingAcks; | ||
4486 | |||
4487 | m_needAck = new Dictionary<uint,Packet>(); | ||
4488 | |||
4489 | Packet packet = null; | ||
4490 | int packetEnd = 0; | ||
4491 | byte[] zero = new byte[3000]; | ||
4492 | |||
4493 | foreach (uint key in info.needAck.Keys) | ||
4494 | { | ||
4495 | byte[] buff = info.needAck[key]; | ||
4496 | |||
4497 | packetEnd = buff.Length - 1; | ||
4498 | |||
4499 | try | ||
4500 | { | ||
4501 | packet = PacketPool.Instance.GetPacket(buff, ref packetEnd, zero); | ||
4502 | } | ||
4503 | catch (Exception) | ||
4504 | { | ||
4505 | //MainLog.Instance.Debug("UDPSERVER", e.ToString()); | ||
4506 | } | ||
4507 | |||
4508 | m_needAck.Add(key, packet); | ||
4509 | } | ||
4510 | |||
4511 | m_sequence = info.sequence; | ||
4512 | } | ||
4376 | } | 4513 | } |
4377 | } | 4514 | } |
diff --git a/OpenSim/Region/ClientStack/PacketQueue.cs b/OpenSim/Region/ClientStack/PacketQueue.cs index a04828f..82f96e8 100644 --- a/OpenSim/Region/ClientStack/PacketQueue.cs +++ b/OpenSim/Region/ClientStack/PacketQueue.cs | |||
@@ -142,8 +142,13 @@ namespace OpenSim.Region.ClientStack | |||
142 | // We could micro lock, but that will tend to actually | 142 | // We could micro lock, but that will tend to actually |
143 | // probably be worse than just synchronizing on SendQueue | 143 | // probably be worse than just synchronizing on SendQueue |
144 | 144 | ||
145 | lock (this) | 145 | if (item == null) |
146 | { | 146 | { |
147 | SendQueue.Enqueue(item); | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | lock (this) { | ||
147 | switch (item.throttleType) | 152 | switch (item.throttleType) |
148 | { | 153 | { |
149 | case ThrottleOutPacketType.Resend: | 154 | case ThrottleOutPacketType.Resend: |
@@ -518,5 +523,10 @@ namespace OpenSim.Region.ClientStack | |||
518 | TextureOutgoingPacketQueue.Count, | 523 | TextureOutgoingPacketQueue.Count, |
519 | AssetOutgoingPacketQueue.Count); | 524 | AssetOutgoingPacketQueue.Count); |
520 | } | 525 | } |
526 | |||
527 | public QueItem[] GetQueueArray() | ||
528 | { | ||
529 | return SendQueue.GetQueueArray(); | ||
530 | } | ||
521 | } | 531 | } |
522 | } | 532 | } |
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 250b90a..02ae79b 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -74,14 +74,14 @@ namespace OpenSim.Region.ClientStack | |||
74 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, | 74 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, |
75 | ClientManager clientManager, IScene scene, AssetCache assetCache, | 75 | ClientManager clientManager, IScene scene, AssetCache assetCache, |
76 | PacketServer packServer, AgentCircuitManager authenSessions, | 76 | PacketServer packServer, AgentCircuitManager authenSessions, |
77 | LLUUID agentId, LLUUID sessionId, uint circuitCode) | 77 | LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) |
78 | { | 78 | { |
79 | return | 79 | return |
80 | new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode); | 80 | new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP); |
81 | } | 81 | } |
82 | 82 | ||
83 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, | 83 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, |
84 | AgentCircuitManager authenticateSessionsClass) | 84 | AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP) |
85 | { | 85 | { |
86 | IClientAPI newuser; | 86 | IClientAPI newuser; |
87 | 87 | ||
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ClientStack | |||
93 | { | 93 | { |
94 | newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this, | 94 | newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this, |
95 | authenticateSessionsClass, useCircuit.CircuitCode.ID, | 95 | authenticateSessionsClass, useCircuit.CircuitCode.ID, |
96 | useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code); | 96 | useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP); |
97 | 97 | ||
98 | m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser); | 98 | m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser); |
99 | 99 | ||
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index a760712..660c3b3 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -104,13 +104,18 @@ namespace OpenSim.Region.ClientStack | |||
104 | 104 | ||
105 | protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer, bool m_permissions) | 105 | protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer, bool m_permissions) |
106 | { | 106 | { |
107 | return SetupScene(regionInfo, 0, out udpServer, m_permissions); | ||
108 | } | ||
109 | |||
110 | protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out UDPServer udpServer, bool m_permissions) | ||
111 | { | ||
107 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | 112 | AgentCircuitManager circuitManager = new AgentCircuitManager(); |
108 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | 113 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; |
109 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | 114 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) |
110 | // listenIP = IPAddress.Parse("0.0.0.0"); | 115 | // listenIP = IPAddress.Parse("0.0.0.0"); |
111 | 116 | ||
112 | uint port = (uint) regionInfo.InternalEndPoint.Port; | 117 | uint port = (uint) regionInfo.InternalEndPoint.Port; |
113 | udpServer = new UDPServer(listenIP, ref port, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); | 118 | udpServer = new UDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); |
114 | regionInfo.InternalEndPoint.Port = (int)port; | 119 | regionInfo.InternalEndPoint.Port = (int)port; |
115 | 120 | ||
116 | Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); | 121 | Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); |
@@ -148,8 +153,8 @@ namespace OpenSim.Region.ClientStack | |||
148 | scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero; | 153 | scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero; |
149 | } | 154 | } |
150 | 155 | ||
151 | scene.LoadPrimsFromStorage(m_permissions); | 156 | scene.LoadPrimsFromStorage(m_permissions, regionInfo.originRegionID); |
152 | scene.loadAllLandObjectsFromStorage(); | 157 | scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); |
153 | scene.performParcelPrimCountUpdate(); | 158 | scene.performParcelPrimCountUpdate(); |
154 | scene.StartTimer(); | 159 | scene.StartTimer(); |
155 | return scene; | 160 | return scene; |
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 9c572cf..5501d3f 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -43,12 +43,15 @@ namespace OpenSim.Region.ClientStack | |||
43 | 43 | ||
44 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | 44 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); |
45 | public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>(); | 45 | public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>(); |
46 | protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>(); | ||
46 | public Socket Server; | 47 | public Socket Server; |
47 | protected IPEndPoint ServerIncoming; | 48 | protected IPEndPoint ServerIncoming; |
48 | protected byte[] RecvBuffer = new byte[4096]; | 49 | protected byte[] RecvBuffer = new byte[4096]; |
49 | protected byte[] ZeroBuffer = new byte[8192]; | 50 | protected byte[] ZeroBuffer = new byte[8192]; |
50 | protected IPEndPoint ipeSender; | 51 | protected IPEndPoint ipeSender; |
51 | protected EndPoint epSender; | 52 | protected EndPoint epSender; |
53 | protected EndPoint epProxy; | ||
54 | protected int proxyPortOffset; | ||
52 | protected AsyncCallback ReceivedData; | 55 | protected AsyncCallback ReceivedData; |
53 | protected PacketServer m_packetServer; | 56 | protected PacketServer m_packetServer; |
54 | protected ulong m_regionHandle; | 57 | protected ulong m_regionHandle; |
@@ -85,10 +88,11 @@ namespace OpenSim.Region.ClientStack | |||
85 | { | 88 | { |
86 | } | 89 | } |
87 | 90 | ||
88 | public UDPServer(IPAddress _listenIP, ref uint port, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) | 91 | public UDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) |
89 | { | 92 | { |
93 | this.proxyPortOffset = proxyPortOffset; | ||
94 | listenPort = (uint) (port + proxyPortOffset); | ||
90 | listenIP = _listenIP; | 95 | listenIP = _listenIP; |
91 | listenPort = port; | ||
92 | Allow_Alternate_Port = allow_alternate_port; | 96 | Allow_Alternate_Port = allow_alternate_port; |
93 | m_assetCache = assetCache; | 97 | m_assetCache = assetCache; |
94 | m_authenticateSessionsClass = authenticateClass; | 98 | m_authenticateSessionsClass = authenticateClass; |
@@ -97,7 +101,7 @@ namespace OpenSim.Region.ClientStack | |||
97 | // Return new port | 101 | // Return new port |
98 | // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. | 102 | // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. |
99 | // So the option allow_alternate_ports="true" was added to default.xml | 103 | // So the option allow_alternate_ports="true" was added to default.xml |
100 | port = listenPort; | 104 | port = (uint)(listenPort - proxyPortOffset); |
101 | } | 105 | } |
102 | 106 | ||
103 | protected virtual void CreatePacketServer() | 107 | protected virtual void CreatePacketServer() |
@@ -211,6 +215,13 @@ namespace OpenSim.Region.ClientStack | |||
211 | //return; | 215 | //return; |
212 | } | 216 | } |
213 | 217 | ||
218 | //System.Console.WriteLine("UDPServer : recieved message from {0}", epSender.ToString()); | ||
219 | epProxy = epSender; | ||
220 | if (proxyPortOffset != 0) | ||
221 | { | ||
222 | epSender = PacketPool.DecodeProxyMessage(RecvBuffer, ref numBytes); | ||
223 | } | ||
224 | |||
214 | int packetEnd = numBytes - 1; | 225 | int packetEnd = numBytes - 1; |
215 | 226 | ||
216 | try | 227 | try |
@@ -318,6 +329,9 @@ namespace OpenSim.Region.ClientStack | |||
318 | 329 | ||
319 | protected virtual void AddNewClient(Packet packet) | 330 | protected virtual void AddNewClient(Packet packet) |
320 | { | 331 | { |
332 | //Slave regions don't accept new clients | ||
333 | if(m_localScene.Region_Status != RegionStatus.SlaveScene) | ||
334 | { | ||
321 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; | 335 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; |
322 | lock (clientCircuits) | 336 | lock (clientCircuits) |
323 | { | 337 | { |
@@ -334,7 +348,17 @@ namespace OpenSim.Region.ClientStack | |||
334 | m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); | 348 | m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); |
335 | } | 349 | } |
336 | 350 | ||
337 | PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); | 351 | lock (proxyCircuits) |
352 | { | ||
353 | if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code)) | ||
354 | proxyCircuits.Add(useCircuit.CircuitCode.Code, epProxy); | ||
355 | else | ||
356 | m_log.Error("[UDPSERVER]: proxyCircuits already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); | ||
357 | } | ||
358 | |||
359 | PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass, epProxy); | ||
360 | } | ||
361 | PacketPool.Instance.ReturnPacket(packet); | ||
338 | } | 362 | } |
339 | 363 | ||
340 | public void ServerListener() | 364 | public void ServerListener() |
@@ -387,10 +411,20 @@ namespace OpenSim.Region.ClientStack | |||
387 | lock (clientCircuits_reverse) | 411 | lock (clientCircuits_reverse) |
388 | { | 412 | { |
389 | if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) | 413 | if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) |
390 | { | 414 | { |
391 | //we found the endpoint so send the packet to it | 415 | //we found the endpoint so send the packet to it |
392 | Server.SendTo(buffer, size, flags, sendto); | 416 | if (proxyPortOffset != 0) |
393 | } | 417 | { |
418 | //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString()); | ||
419 | PacketPool.EncodeProxyMessage(buffer, ref size, sendto); | ||
420 | Server.SendTo(buffer, size, flags, proxyCircuits[circuitcode]); | ||
421 | } | ||
422 | else | ||
423 | { | ||
424 | //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString()); | ||
425 | Server.SendTo(buffer, size, flags, sendto); | ||
426 | } | ||
427 | } | ||
394 | } | 428 | } |
395 | } | 429 | } |
396 | 430 | ||
@@ -404,8 +438,50 @@ namespace OpenSim.Region.ClientStack | |||
404 | clientCircuits.Remove(sendto); | 438 | clientCircuits.Remove(sendto); |
405 | 439 | ||
406 | clientCircuits_reverse.Remove(circuitcode); | 440 | clientCircuits_reverse.Remove(circuitcode); |
441 | proxyCircuits.Remove(circuitcode); | ||
407 | } | 442 | } |
408 | } | 443 | } |
409 | } | 444 | } |
445 | |||
446 | public void RestoreClient(AgentCircuitData circuit, EndPoint userEP, EndPoint proxyEP) | ||
447 | { | ||
448 | //MainLog.Instance.Verbose("UDPSERVER", "RestoreClient"); | ||
449 | |||
450 | UseCircuitCodePacket useCircuit = new UseCircuitCodePacket(); | ||
451 | useCircuit.CircuitCode.Code = circuit.circuitcode; | ||
452 | useCircuit.CircuitCode.ID = circuit.AgentID; | ||
453 | useCircuit.CircuitCode.SessionID = circuit.SessionID; | ||
454 | |||
455 | lock (clientCircuits) | ||
456 | { | ||
457 | if (!clientCircuits.ContainsKey(userEP)) | ||
458 | clientCircuits.Add(userEP, useCircuit.CircuitCode.Code); | ||
459 | else | ||
460 | m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); | ||
461 | } | ||
462 | lock (clientCircuits_reverse) | ||
463 | { | ||
464 | if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code)) | ||
465 | clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP); | ||
466 | else | ||
467 | m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); | ||
468 | } | ||
469 | |||
470 | lock (proxyCircuits) | ||
471 | { | ||
472 | if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code)) | ||
473 | { | ||
474 | proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP); | ||
475 | } | ||
476 | else | ||
477 | { | ||
478 | // re-set proxy endpoint | ||
479 | proxyCircuits.Remove(useCircuit.CircuitCode.Code); | ||
480 | proxyCircuits.Add(useCircuit.CircuitCode.Code, proxyEP); | ||
481 | } | ||
482 | } | ||
483 | |||
484 | PacketServer.AddNewClient(userEP, useCircuit, m_assetCache, m_authenticateSessionsClass, proxyEP); | ||
485 | } | ||
410 | } | 486 | } |
411 | } | 487 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 12c91ac..cdafad3 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -111,6 +111,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
111 | GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); | 111 | GridParams["http_port"] = serversInfo.HttpListenerPort.ToString(); |
112 | GridParams["remoting_port"] = NetworkServersInfo.RemotingListenerPort.ToString(); | 112 | GridParams["remoting_port"] = NetworkServersInfo.RemotingListenerPort.ToString(); |
113 | GridParams["map-image-id"] = regionInfo.EstateSettings.terrainImageID.ToString(); | 113 | GridParams["map-image-id"] = regionInfo.EstateSettings.terrainImageID.ToString(); |
114 | GridParams["originUUID"] = regionInfo.originRegionID.ToString(); | ||
115 | GridParams["server_uri"] = regionInfo.ServerURI; | ||
114 | 116 | ||
115 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) | 117 | // part of an initial brutish effort to provide accurate information (as per the xml region spec) |
116 | // wrt the ownership of a given region | 118 | // wrt the ownership of a given region |
@@ -165,7 +167,30 @@ namespace OpenSim.Region.Communications.OGS1 | |||
165 | 167 | ||
166 | public bool DeregisterRegion(RegionInfo regionInfo) | 168 | public bool DeregisterRegion(RegionInfo regionInfo) |
167 | { | 169 | { |
168 | return false; | 170 | Hashtable GridParams = new Hashtable(); |
171 | |||
172 | GridParams["UUID"] = regionInfo.RegionID.ToString(); | ||
173 | |||
174 | // Package into an XMLRPC Request | ||
175 | ArrayList SendParams = new ArrayList(); | ||
176 | SendParams.Add(GridParams); | ||
177 | |||
178 | // Send Request | ||
179 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams); | ||
180 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000); | ||
181 | Hashtable GridRespData = (Hashtable) GridResp.Value; | ||
182 | |||
183 | Hashtable griddatahash = GridRespData; | ||
184 | |||
185 | // Process Response | ||
186 | if (GridRespData.ContainsKey("error")) { | ||
187 | string errorstring = (string)GridRespData["error"]; | ||
188 | m_log.Error("Unable to connect to grid: " + errorstring); | ||
189 | return false; | ||
190 | } | ||
191 | |||
192 | // What does DeregisterRegion() do? | ||
193 | return m_localBackend.DeregisterRegion(regionInfo); | ||
169 | } | 194 | } |
170 | 195 | ||
171 | public virtual Dictionary<string, string> GetGridSettings() | 196 | public virtual Dictionary<string, string> GetGridSettings() |
@@ -1209,7 +1234,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1209 | } | 1234 | } |
1210 | 1235 | ||
1211 | return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle); | 1236 | return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle); |
1212 | |||
1213 | } | 1237 | } |
1214 | 1238 | ||
1215 | catch (RemotingException e) | 1239 | catch (RemotingException e) |
diff --git a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs index b54f777..fcc8fdf 100644 --- a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs +++ b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs | |||
@@ -26,13 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
29 | using libsecondlife; | 30 | using libsecondlife; |
30 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
32 | 33 | using System.Runtime.Serialization; | |
34 | using System.Security.Permissions; | ||
33 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
34 | { | 36 | { |
35 | public class AvatarAppearance | 37 | [Serializable] |
38 | public class AvatarAppearance : ISerializable | ||
36 | { | 39 | { |
37 | protected LLUUID m_scenePresenceID; | 40 | protected LLUUID m_scenePresenceID; |
38 | 41 | ||
@@ -149,5 +152,45 @@ namespace OpenSim.Region.Environment.Scenes | |||
149 | textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); | 152 | textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); |
150 | return textu; | 153 | return textu; |
151 | } | 154 | } |
155 | |||
156 | protected AvatarAppearance(SerializationInfo info, StreamingContext context) | ||
157 | { | ||
158 | //System.Console.WriteLine("AvatarAppearance Deserialize BGN"); | ||
159 | |||
160 | if (info == null) | ||
161 | { | ||
162 | throw new System.ArgumentNullException("info"); | ||
163 | } | ||
164 | |||
165 | m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid))); | ||
166 | m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int)); | ||
167 | m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[])); | ||
168 | m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[])); | ||
169 | |||
170 | byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[])); | ||
171 | m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length); | ||
172 | |||
173 | m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float)); | ||
174 | |||
175 | //System.Console.WriteLine("AvatarAppearance Deserialize END"); | ||
176 | } | ||
177 | |||
178 | [SecurityPermission(SecurityAction.LinkDemand, | ||
179 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
180 | public virtual void GetObjectData( | ||
181 | SerializationInfo info, StreamingContext context) | ||
182 | { | ||
183 | if (info == null) | ||
184 | { | ||
185 | throw new System.ArgumentNullException("info"); | ||
186 | } | ||
187 | |||
188 | info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID); | ||
189 | info.AddValue("m_wearablesSerial", m_wearablesSerial); | ||
190 | info.AddValue("m_visualParams", m_visualParams); | ||
191 | info.AddValue("m_wearables", m_wearables); | ||
192 | info.AddValue("m_textureEntry", m_textureEntry.ToBytes()); | ||
193 | info.AddValue("m_avatarHeight", m_avatarHeight); | ||
194 | } | ||
152 | } | 195 | } |
153 | } \ No newline at end of file | 196 | } |
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 91dda74..2a8c1e9 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -30,9 +30,14 @@ using System.Collections.Generic; | |||
30 | using Axiom.Math; | 30 | using Axiom.Math; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | 32 | ||
33 | using System; | ||
34 | using System.Runtime.Serialization; | ||
35 | using System.Security.Permissions; | ||
36 | |||
33 | namespace OpenSim.Region.Environment.Scenes | 37 | namespace OpenSim.Region.Environment.Scenes |
34 | { | 38 | { |
35 | public abstract class EntityBase | 39 | [Serializable] |
40 | public abstract class EntityBase : ISerializable | ||
36 | { | 41 | { |
37 | protected Scene m_scene; | 42 | protected Scene m_scene; |
38 | 43 | ||
@@ -134,6 +139,90 @@ namespace OpenSim.Region.Environment.Scenes | |||
134 | 139 | ||
135 | 140 | ||
136 | public abstract void SetText(string text, Vector3 color, double alpha); | 141 | public abstract void SetText(string text, Vector3 color, double alpha); |
142 | |||
143 | protected EntityBase(SerializationInfo info, StreamingContext context) | ||
144 | { | ||
145 | //System.Console.WriteLine("EntityBase Deserialize BGN"); | ||
146 | |||
147 | if (info == null) | ||
148 | { | ||
149 | throw new System.ArgumentNullException("info"); | ||
150 | } | ||
151 | |||
152 | //JB m_children = (List<EntityBase>)info.GetValue("m_children", typeof(List<EntityBase>)); | ||
153 | // m_scene = (Scene)info.GetValue("m_scene", typeof(Scene)); | ||
154 | m_uuid = new LLUUID((Guid)info.GetValue("m_uuid", typeof(Guid))); | ||
155 | m_name = (string)info.GetValue("m_name", typeof(string)); | ||
156 | |||
157 | m_pos | ||
158 | = new LLVector3( | ||
159 | (float)info.GetValue("m_pos.X", typeof(float)), | ||
160 | (float)info.GetValue("m_pos.Y", typeof(float)), | ||
161 | (float)info.GetValue("m_pos.Z", typeof(float))); | ||
162 | |||
163 | m_velocity | ||
164 | = new LLVector3( | ||
165 | (float)info.GetValue("m_velocity.X", typeof(float)), | ||
166 | (float)info.GetValue("m_velocity.Y", typeof(float)), | ||
167 | (float)info.GetValue("m_velocity.Z", typeof(float))); | ||
168 | |||
169 | m_rotationalvelocity | ||
170 | = new LLVector3( | ||
171 | (float)info.GetValue("m_rotationalvelocity.X", typeof(float)), | ||
172 | (float)info.GetValue("m_rotationalvelocity.Y", typeof(float)), | ||
173 | (float)info.GetValue("m_rotationalvelocity.Z", typeof(float))); | ||
174 | |||
175 | m_rotation | ||
176 | = new Quaternion( | ||
177 | (float)info.GetValue("m_rotation.w", typeof(float)), | ||
178 | (float)info.GetValue("m_rotation.x", typeof(float)), | ||
179 | (float)info.GetValue("m_rotation.y", typeof(float)), | ||
180 | (float)info.GetValue("m_rotation.z", typeof(float))); | ||
181 | |||
182 | m_localId = (uint)info.GetValue("m_localId", typeof(uint)); | ||
183 | |||
184 | //System.Console.WriteLine("EntityBase Deserialize END"); | ||
185 | } | ||
186 | |||
187 | [SecurityPermission(SecurityAction.LinkDemand, | ||
188 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
189 | public virtual void GetObjectData( | ||
190 | SerializationInfo info, StreamingContext context) | ||
191 | { | ||
192 | if (info == null) | ||
193 | { | ||
194 | throw new System.ArgumentNullException("info"); | ||
195 | } | ||
196 | |||
197 | //JB info.AddValue("m_children", m_children); | ||
198 | |||
199 | // info.AddValue("m_scene", m_scene); | ||
200 | info.AddValue("m_uuid", m_uuid.UUID); | ||
201 | info.AddValue("m_name", m_name); | ||
202 | |||
203 | // LLVector3 | ||
204 | info.AddValue("m_pos.X", m_pos.X); | ||
205 | info.AddValue("m_pos.Y", m_pos.Y); | ||
206 | info.AddValue("m_pos.Z", m_pos.Z); | ||
207 | |||
208 | // LLVector3 | ||
209 | info.AddValue("m_velocity.X", m_velocity.X); | ||
210 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
211 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
212 | |||
213 | // LLVector3 | ||
214 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
215 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
216 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
217 | |||
218 | // Quaternion | ||
219 | info.AddValue("m_rotation.w", m_rotation.w); | ||
220 | info.AddValue("m_rotation.x", m_rotation.x); | ||
221 | info.AddValue("m_rotation.y", m_rotation.y); | ||
222 | info.AddValue("m_rotation.z", m_rotation.z); | ||
223 | |||
224 | info.AddValue("m_localId", m_localId); | ||
225 | } | ||
137 | } | 226 | } |
138 | 227 | ||
139 | //Nested Classes | 228 | //Nested Classes |
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 860f5fb..882e589 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | // SceneObjects is not currently populated or used. | 57 | // SceneObjects is not currently populated or used. |
58 | //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; | 58 | //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; |
59 | public Dictionary<LLUUID, EntityBase> Entities; | 59 | public Dictionary<LLUUID, EntityBase> Entities; |
60 | public Dictionary<LLUUID, ScenePresence> RestorePresences; | ||
60 | 61 | ||
61 | public BasicQuadTreeNode QuadTree; | 62 | public BasicQuadTreeNode QuadTree; |
62 | 63 | ||
@@ -455,6 +456,48 @@ namespace OpenSim.Region.Environment.Scenes | |||
455 | return newAvatar; | 456 | return newAvatar; |
456 | } | 457 | } |
457 | 458 | ||
459 | public void AddScenePresence(ScenePresence presence) | ||
460 | { | ||
461 | bool child = presence.IsChildAgent; | ||
462 | |||
463 | if (child) | ||
464 | { | ||
465 | m_numChildAgents++; | ||
466 | m_log.Info("[SCENE]"+ m_regInfo.RegionName + ": Creating new child agent."); | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | m_numRootAgents++; | ||
471 | m_log.Info("[SCENE] "+ m_regInfo.RegionName + ": Creating new root agent."); | ||
472 | m_log.Info("[SCENE] "+ m_regInfo.RegionName + ": Adding Physical agent."); | ||
473 | |||
474 | presence.AddToPhysicalScene(); | ||
475 | } | ||
476 | |||
477 | lock (Entities) | ||
478 | { | ||
479 | if (!Entities.ContainsKey(presence.m_uuid)) | ||
480 | { | ||
481 | Entities.Add(presence.m_uuid, presence); | ||
482 | } | ||
483 | else | ||
484 | { | ||
485 | Entities[presence.m_uuid] = presence; | ||
486 | } | ||
487 | } | ||
488 | lock (ScenePresences) | ||
489 | { | ||
490 | if (ScenePresences.ContainsKey(presence.m_uuid)) | ||
491 | { | ||
492 | ScenePresences[presence.m_uuid] = presence; | ||
493 | } | ||
494 | else | ||
495 | { | ||
496 | ScenePresences.Add(presence.m_uuid, presence); | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | |||
458 | public void SwapRootChildAgent(bool direction_RC_CR_T_F) | 501 | public void SwapRootChildAgent(bool direction_RC_CR_T_F) |
459 | { | 502 | { |
460 | if (direction_RC_CR_T_F) | 503 | if (direction_RC_CR_T_F) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 845de22..43e7e99 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -54,6 +54,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
54 | 54 | ||
55 | public partial class Scene : SceneBase | 55 | public partial class Scene : SceneBase |
56 | { | 56 | { |
57 | public delegate void SynchronizeSceneHandler(Scene scene); | ||
58 | public SynchronizeSceneHandler SynchronizeScene = null; | ||
59 | public int splitID = 0; | ||
60 | |||
57 | #region Fields | 61 | #region Fields |
58 | 62 | ||
59 | protected Timer m_heartbeatTimer = new Timer(); | 63 | protected Timer m_heartbeatTimer = new Timer(); |
@@ -216,7 +220,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | get { return m_innerScene.Entities; } | 220 | get { return m_innerScene.Entities; } |
217 | set { m_innerScene.Entities = value; } | 221 | set { m_innerScene.Entities = value; } |
218 | } | 222 | } |
219 | 223 | public Dictionary<LLUUID, ScenePresence> m_restorePresences | |
224 | { | ||
225 | get { return m_innerScene.RestorePresences; } | ||
226 | set { m_innerScene.RestorePresences = value; } | ||
227 | } | ||
220 | #endregion | 228 | #endregion |
221 | 229 | ||
222 | #region Constructors | 230 | #region Constructors |
@@ -276,6 +284,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
276 | Entities = new Dictionary<LLUUID, EntityBase>(); | 284 | Entities = new Dictionary<LLUUID, EntityBase>(); |
277 | m_scenePresences = new Dictionary<LLUUID, ScenePresence>(); | 285 | m_scenePresences = new Dictionary<LLUUID, ScenePresence>(); |
278 | //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); | 286 | //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); |
287 | m_restorePresences = new Dictionary<LLUUID, ScenePresence>(); | ||
279 | 288 | ||
280 | m_log.Info("[SCENE]: Creating LandMap"); | 289 | m_log.Info("[SCENE]: Creating LandMap"); |
281 | Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); | 290 | Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); |
@@ -701,6 +710,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
701 | physicsFPS = m_innerScene.UpdatePhysics( | 710 | physicsFPS = m_innerScene.UpdatePhysics( |
702 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) | 711 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) |
703 | ); | 712 | ); |
713 | if (m_frame % m_update_physics == 0 && SynchronizeScene != null) | ||
714 | SynchronizeScene(this); | ||
704 | 715 | ||
705 | physicsMS = System.Environment.TickCount - physicsMS; | 716 | physicsMS = System.Environment.TickCount - physicsMS; |
706 | physicsMS += physicsMS2; | 717 | physicsMS += physicsMS2; |
@@ -719,6 +730,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
719 | if (m_frame % m_update_presences == 0) | 730 | if (m_frame % m_update_presences == 0) |
720 | m_innerScene.UpdatePresences(); | 731 | m_innerScene.UpdatePresences(); |
721 | 732 | ||
733 | if (Region_Status != RegionStatus.SlaveScene) | ||
734 | { | ||
722 | if (m_frame % m_update_events == 0) | 735 | if (m_frame % m_update_events == 0) |
723 | UpdateEvents(); | 736 | UpdateEvents(); |
724 | 737 | ||
@@ -747,7 +760,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
747 | m_statsReporter.addOtherMS(otherMS); | 760 | m_statsReporter.addOtherMS(otherMS); |
748 | m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); | 761 | m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts()); |
749 | m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); | 762 | m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS()); |
750 | 763 | } | |
751 | } | 764 | } |
752 | catch (NotImplementedException) | 765 | catch (NotImplementedException) |
753 | { | 766 | { |
@@ -1058,10 +1071,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1058 | 1071 | ||
1059 | #region Load Land | 1072 | #region Load Land |
1060 | 1073 | ||
1061 | public void loadAllLandObjectsFromStorage() | 1074 | public void loadAllLandObjectsFromStorage(LLUUID regionID) |
1062 | { | 1075 | { |
1063 | m_log.Info("[SCENE]: Loading land objects from storage"); | 1076 | m_log.Info("[SCENE]: Loading land objects from storage"); |
1064 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID); | 1077 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); |
1065 | 1078 | ||
1066 | if (landData.Count == 0) | 1079 | if (landData.Count == 0) |
1067 | { | 1080 | { |
@@ -1080,11 +1093,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1080 | /// <summary> | 1093 | /// <summary> |
1081 | /// Loads the World's objects | 1094 | /// Loads the World's objects |
1082 | /// </summary> | 1095 | /// </summary> |
1083 | public virtual void LoadPrimsFromStorage(bool m_permissions) | 1096 | public virtual void LoadPrimsFromStorage(bool m_permissions, LLUUID regionID) |
1084 | { | 1097 | { |
1085 | m_log.Info("[SCENE]: Loading objects from datastore"); | 1098 | m_log.Info("[SCENE]: Loading objects from datastore"); |
1086 | 1099 | ||
1087 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID); | 1100 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); |
1088 | foreach (SceneObjectGroup group in PrimsFromDB) | 1101 | foreach (SceneObjectGroup group in PrimsFromDB) |
1089 | { | 1102 | { |
1090 | AddEntityFromStorage(group); | 1103 | AddEntityFromStorage(group); |
@@ -1339,13 +1352,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
1339 | { | 1352 | { |
1340 | m_log.Warn("[CONNECTION DEBUGGING]: Creating new client for " + client.AgentId.ToString()); | 1353 | m_log.Warn("[CONNECTION DEBUGGING]: Creating new client for " + client.AgentId.ToString()); |
1341 | SubscribeToClientEvents(client); | 1354 | SubscribeToClientEvents(client); |
1355 | ScenePresence presence = null; | ||
1356 | |||
1357 | if (m_restorePresences.ContainsKey(client.AgentId)) | ||
1358 | { | ||
1359 | m_log.Info("REGION Restore Scene Presence"); | ||
1360 | |||
1361 | presence = m_restorePresences[client.AgentId]; | ||
1362 | m_restorePresences.Remove(client.AgentId); | ||
1363 | |||
1364 | presence.initializeScenePresence(client, RegionInfo, this); | ||
1365 | |||
1366 | m_innerScene.AddScenePresence(presence); | ||
1342 | 1367 | ||
1343 | m_estateManager.sendRegionHandshake(client); | 1368 | lock (m_restorePresences) |
1369 | { | ||
1370 | Monitor.PulseAll(m_restorePresences); | ||
1371 | } | ||
1372 | } | ||
1373 | else | ||
1374 | { | ||
1375 | m_log.Info("REGION Add New Scene Presence"); | ||
1344 | 1376 | ||
1345 | CreateAndAddScenePresence(client, child); | 1377 | m_estateManager.sendRegionHandshake(client); |
1346 | 1378 | ||
1347 | m_LandManager.sendParcelOverlay(client); | 1379 | CreateAndAddScenePresence(client, child); |
1348 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 1380 | |
1381 | m_LandManager.sendParcelOverlay(client); | ||
1382 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | ||
1383 | } | ||
1349 | } | 1384 | } |
1350 | 1385 | ||
1351 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 1386 | protected virtual void SubscribeToClientEvents(IClientAPI client) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index a6a5063..46bb89c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -39,6 +39,8 @@ using OpenSim.Framework.Console; | |||
39 | using OpenSim.Region.Environment.Interfaces; | 39 | using OpenSim.Region.Environment.Interfaces; |
40 | using OpenSim.Region.Environment.Scenes.Scripting; | 40 | using OpenSim.Region.Environment.Scenes.Scripting; |
41 | using OpenSim.Region.Physics.Manager; | 41 | using OpenSim.Region.Physics.Manager; |
42 | using System.Runtime.Serialization; | ||
43 | using System.Security.Permissions; | ||
42 | 44 | ||
43 | namespace OpenSim.Region.Environment.Scenes | 45 | namespace OpenSim.Region.Environment.Scenes |
44 | { | 46 | { |
@@ -82,7 +84,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
82 | SCALE = 0x40 | 84 | SCALE = 0x40 |
83 | } | 85 | } |
84 | 86 | ||
85 | public partial class SceneObjectPart : IScriptHost | 87 | [Serializable] |
88 | public partial class SceneObjectPart : IScriptHost, ISerializable | ||
86 | { | 89 | { |
87 | 90 | ||
88 | [XmlIgnore] public PhysicsActor PhysActor = null; | 91 | [XmlIgnore] public PhysicsActor PhysActor = null; |
@@ -1859,5 +1862,119 @@ namespace OpenSim.Region.Environment.Scenes | |||
1859 | (int) (color.z*0xff)); | 1862 | (int) (color.z*0xff)); |
1860 | Text = text; | 1863 | Text = text; |
1861 | } | 1864 | } |
1865 | |||
1866 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | ||
1867 | { | ||
1868 | //System.Console.WriteLine("SceneObjectPart Deserialize BGN"); | ||
1869 | |||
1870 | if (info == null) | ||
1871 | { | ||
1872 | throw new System.ArgumentNullException("info"); | ||
1873 | } | ||
1874 | |||
1875 | /* | ||
1876 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); | ||
1877 | m_ids = (List<LLUUID>)info.GetValue("m_ids", typeof(List<LLUUID>)); | ||
1878 | */ | ||
1879 | |||
1880 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); | ||
1881 | } | ||
1882 | |||
1883 | [SecurityPermission(SecurityAction.LinkDemand, | ||
1884 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
1885 | public virtual void GetObjectData( | ||
1886 | SerializationInfo info, StreamingContext context) | ||
1887 | { | ||
1888 | if (info == null) | ||
1889 | { | ||
1890 | throw new System.ArgumentNullException("info"); | ||
1891 | } | ||
1892 | |||
1893 | info.AddValue("m_inventoryFileName", m_inventoryFileName); | ||
1894 | info.AddValue("m_folderID", m_folderID.UUID); | ||
1895 | info.AddValue("PhysActor", PhysActor); | ||
1896 | |||
1897 | Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); | ||
1898 | |||
1899 | foreach (LLUUID id in TaskInventory.Keys) | ||
1900 | { | ||
1901 | TaskInventory_work.Add(id.UUID, TaskInventory[id]); | ||
1902 | } | ||
1903 | |||
1904 | info.AddValue("TaskInventory", TaskInventory_work); | ||
1905 | |||
1906 | info.AddValue("LastOwnerID", LastOwnerID.UUID); | ||
1907 | info.AddValue("OwnerID", OwnerID.UUID); | ||
1908 | info.AddValue("GroupID", GroupID.UUID); | ||
1909 | |||
1910 | info.AddValue("OwnershipCost", OwnershipCost); | ||
1911 | info.AddValue("ObjectSaleType", ObjectSaleType); | ||
1912 | info.AddValue("SalePrice", SalePrice); | ||
1913 | info.AddValue("Category", Category); | ||
1914 | |||
1915 | info.AddValue("CreationDate", CreationDate); | ||
1916 | info.AddValue("ParentID", ParentID); | ||
1917 | |||
1918 | info.AddValue("OwnerMask", OwnerMask); | ||
1919 | info.AddValue("NextOwnerMask", NextOwnerMask); | ||
1920 | info.AddValue("GroupMask", GroupMask); | ||
1921 | info.AddValue("EveryoneMask", EveryoneMask); | ||
1922 | info.AddValue("BaseMask", BaseMask); | ||
1923 | |||
1924 | info.AddValue("m_particleSystem", m_particleSystem); | ||
1925 | |||
1926 | info.AddValue("TimeStampFull", TimeStampFull); | ||
1927 | info.AddValue("TimeStampTerse", TimeStampTerse); | ||
1928 | info.AddValue("TimeStampLastActivity", TimeStampLastActivity); | ||
1929 | |||
1930 | info.AddValue("m_updateFlag", m_updateFlag); | ||
1931 | info.AddValue("CreatorID", CreatorID.UUID); | ||
1932 | |||
1933 | info.AddValue("m_inventorySerial", m_inventorySerial); | ||
1934 | info.AddValue("m_uuid", m_uuid.UUID); | ||
1935 | info.AddValue("m_localID", m_localID); | ||
1936 | info.AddValue("m_name", m_name); | ||
1937 | info.AddValue("m_flags", Flags); | ||
1938 | info.AddValue("m_material", m_material); | ||
1939 | info.AddValue("m_regionHandle", m_regionHandle); | ||
1940 | |||
1941 | info.AddValue("m_groupPosition.X", m_groupPosition.X); | ||
1942 | info.AddValue("m_groupPosition.Y", m_groupPosition.Y); | ||
1943 | info.AddValue("m_groupPosition.Z", m_groupPosition.Z); | ||
1944 | |||
1945 | info.AddValue("m_offsetPosition.X", m_offsetPosition.X); | ||
1946 | info.AddValue("m_offsetPosition.Y", m_offsetPosition.Y); | ||
1947 | info.AddValue("m_offsetPosition.Z", m_offsetPosition.Z); | ||
1948 | |||
1949 | info.AddValue("m_rotationOffset.W", m_rotationOffset.W); | ||
1950 | info.AddValue("m_rotationOffset.X", m_rotationOffset.X); | ||
1951 | info.AddValue("m_rotationOffset.Y", m_rotationOffset.Y); | ||
1952 | info.AddValue("m_rotationOffset.Z", m_rotationOffset.Z); | ||
1953 | |||
1954 | info.AddValue("m_velocity.X", m_velocity.X); | ||
1955 | info.AddValue("m_velocity.Y", m_velocity.Y); | ||
1956 | info.AddValue("m_velocity.Z", m_velocity.Z); | ||
1957 | |||
1958 | info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X); | ||
1959 | info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y); | ||
1960 | info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z); | ||
1961 | |||
1962 | info.AddValue("m_angularVelocity.X", m_angularVelocity.X); | ||
1963 | info.AddValue("m_angularVelocity.Y", m_angularVelocity.Y); | ||
1964 | info.AddValue("m_angularVelocity.Z", m_angularVelocity.Z); | ||
1965 | |||
1966 | info.AddValue("m_acceleration.X", m_acceleration.X); | ||
1967 | info.AddValue("m_acceleration.Y", m_acceleration.Y); | ||
1968 | info.AddValue("m_acceleration.Z", m_acceleration.Z); | ||
1969 | |||
1970 | info.AddValue("m_description", m_description); | ||
1971 | info.AddValue("m_color", m_color); | ||
1972 | info.AddValue("m_text", m_text); | ||
1973 | info.AddValue("m_sitName", m_sitName); | ||
1974 | info.AddValue("m_touchName", m_touchName); | ||
1975 | info.AddValue("m_clickAction", m_clickAction); | ||
1976 | info.AddValue("m_shape", m_shape); | ||
1977 | info.AddValue("m_parentGroup", m_parentGroup); | ||
1978 | } | ||
1862 | } | 1979 | } |
1863 | } | 1980 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 2c201ba..fabc3ed 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -34,10 +34,14 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Region.Environment.Types; | 35 | using OpenSim.Region.Environment.Types; |
36 | using OpenSim.Region.Physics.Manager; | 36 | using OpenSim.Region.Physics.Manager; |
37 | using OpenSim.Region.Environment.Interfaces; | ||
38 | using System.Runtime.Serialization; | ||
39 | using System.Security.Permissions; | ||
37 | 40 | ||
38 | namespace OpenSim.Region.Environment.Scenes | 41 | namespace OpenSim.Region.Environment.Scenes |
39 | { | 42 | { |
40 | public class ScenePresence : EntityBase | 43 | [Serializable] |
44 | public class ScenePresence : EntityBase, ISerializable | ||
41 | { | 45 | { |
42 | // ~ScenePresence() | 46 | // ~ScenePresence() |
43 | // { | 47 | // { |
@@ -156,6 +160,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
156 | get { return m_physicsActor; } | 160 | get { return m_physicsActor; } |
157 | } | 161 | } |
158 | 162 | ||
163 | public byte MovementFlag | ||
164 | { | ||
165 | set { m_movementflag = value; } | ||
166 | get { return m_movementflag; } | ||
167 | } | ||
168 | |||
159 | public bool KnownPrim(LLUUID primID) | 169 | public bool KnownPrim(LLUUID primID) |
160 | { | 170 | { |
161 | if (m_knownPrimUUID.Contains(primID)) | 171 | if (m_knownPrimUUID.Contains(primID)) |
@@ -215,13 +225,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
215 | /// <summary> | 225 | /// <summary> |
216 | /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager | 226 | /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager |
217 | /// </summary> | 227 | /// </summary> |
218 | private readonly IClientAPI m_controllingClient; | 228 | private IClientAPI m_controllingClient; |
219 | 229 | ||
220 | protected PhysicsActor m_physicsActor; | 230 | protected PhysicsActor m_physicsActor; |
221 | 231 | ||
222 | public IClientAPI ControllingClient | 232 | public IClientAPI ControllingClient |
223 | { | 233 | { |
224 | get { return m_controllingClient; } | 234 | get { return m_controllingClient; } |
235 | set { m_controllingClient = value; } | ||
225 | } | 236 | } |
226 | 237 | ||
227 | protected LLVector3 m_parentPosition = new LLVector3(); | 238 | protected LLVector3 m_parentPosition = new LLVector3(); |
@@ -379,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
379 | m_appearance = appearance; | 390 | m_appearance = appearance; |
380 | } | 391 | } |
381 | 392 | ||
382 | private void RegisterToEvents() | 393 | public void RegisterToEvents() |
383 | { | 394 | { |
384 | m_controllingClient.OnRequestWearables += SendOwnAppearance; | 395 | m_controllingClient.OnRequestWearables += SendOwnAppearance; |
385 | m_controllingClient.OnSetAppearance += SetAppearance; | 396 | m_controllingClient.OnSetAppearance += SetAppearance; |
@@ -1706,6 +1717,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1706 | DefaultTexture = textu.ToBytes(); | 1717 | DefaultTexture = textu.ToBytes(); |
1707 | } | 1718 | } |
1708 | 1719 | ||
1720 | [Serializable] | ||
1709 | public class NewForce | 1721 | public class NewForce |
1710 | { | 1722 | { |
1711 | public float X; | 1723 | public float X; |
@@ -1717,7 +1729,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1717 | } | 1729 | } |
1718 | } | 1730 | } |
1719 | 1731 | ||
1720 | public class ScenePartUpdate | 1732 | [Serializable] |
1733 | public class ScenePartUpdate : ISerializable | ||
1721 | { | 1734 | { |
1722 | public LLUUID FullID; | 1735 | public LLUUID FullID; |
1723 | public uint LastFullUpdateTime; | 1736 | public uint LastFullUpdateTime; |
@@ -1729,6 +1742,38 @@ namespace OpenSim.Region.Environment.Scenes | |||
1729 | LastFullUpdateTime = 0; | 1742 | LastFullUpdateTime = 0; |
1730 | LastTerseUpdateTime = 0; | 1743 | LastTerseUpdateTime = 0; |
1731 | } | 1744 | } |
1745 | |||
1746 | protected ScenePartUpdate(SerializationInfo info, StreamingContext context) | ||
1747 | { | ||
1748 | //System.Console.WriteLine("ScenePartUpdate Deserialize BGN"); | ||
1749 | |||
1750 | if (info == null) | ||
1751 | { | ||
1752 | throw new System.ArgumentNullException("info"); | ||
1753 | } | ||
1754 | |||
1755 | FullID = new LLUUID((Guid)info.GetValue("FullID", typeof(Guid))); | ||
1756 | LastFullUpdateTime = (uint)info.GetValue("LastFullUpdateTime", typeof(uint)); | ||
1757 | LastTerseUpdateTime = (uint)info.GetValue("LastTerseUpdateTime", typeof(uint)); | ||
1758 | |||
1759 | //System.Console.WriteLine("ScenePartUpdate Deserialize END"); | ||
1760 | } | ||
1761 | |||
1762 | [SecurityPermission(SecurityAction.LinkDemand, | ||
1763 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
1764 | public virtual void GetObjectData( | ||
1765 | SerializationInfo info, StreamingContext context) | ||
1766 | { | ||
1767 | if (info == null) | ||
1768 | { | ||
1769 | throw new System.ArgumentNullException("info"); | ||
1770 | } | ||
1771 | |||
1772 | info.AddValue("FullID", FullID.UUID); | ||
1773 | info.AddValue("LastFullUpdateTime", LastFullUpdateTime); | ||
1774 | info.AddValue("LastTerseUpdateTime", LastTerseUpdateTime); | ||
1775 | |||
1776 | } | ||
1732 | } | 1777 | } |
1733 | 1778 | ||
1734 | public override void SetText(string text, Vector3 color, double alpha) | 1779 | public override void SetText(string text, Vector3 color, double alpha) |
@@ -1787,5 +1832,368 @@ namespace OpenSim.Region.Environment.Scenes | |||
1787 | RemoveFromPhysicalScene(); | 1832 | RemoveFromPhysicalScene(); |
1788 | GC.Collect(); | 1833 | GC.Collect(); |
1789 | } | 1834 | } |
1835 | |||
1836 | public ScenePresence() | ||
1837 | { | ||
1838 | /* JB | ||
1839 | if (Animations == null) | ||
1840 | { | ||
1841 | Animations = new AvatarAnimations(); | ||
1842 | Animations.LoadAnims(); | ||
1843 | } | ||
1844 | */ | ||
1845 | if (DefaultTexture == null) | ||
1846 | { | ||
1847 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
1848 | DefaultTexture = textu.ToBytes(); | ||
1849 | } | ||
1850 | } | ||
1851 | |||
1852 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) | ||
1853 | { | ||
1854 | m_controllingClient = client; | ||
1855 | m_regionInfo = region; | ||
1856 | m_scene = scene; | ||
1857 | RegisterToEvents(); | ||
1858 | |||
1859 | /* | ||
1860 | AbsolutePosition = client.StartPos; | ||
1861 | |||
1862 | Animations = new AvatarAnimations(); | ||
1863 | Animations.LoadAnims(); | ||
1864 | |||
1865 | m_animations = new List<LLUUID>(); | ||
1866 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); | ||
1867 | m_animationSeqs.Add(1); | ||
1868 | |||
1869 | SetDirectionVectors(); | ||
1870 | */ | ||
1871 | } | ||
1872 | |||
1873 | protected ScenePresence(SerializationInfo info, StreamingContext context) | ||
1874 | : base (info, context) | ||
1875 | { | ||
1876 | //System.Console.WriteLine("ScenePresence Deserialize BGN"); | ||
1877 | |||
1878 | if (info == null) | ||
1879 | { | ||
1880 | throw new System.ArgumentNullException("info"); | ||
1881 | } | ||
1882 | /* JB | ||
1883 | if (Animations == null) | ||
1884 | { | ||
1885 | Animations = new AvatarAnimations(); | ||
1886 | Animations.LoadAnims(); | ||
1887 | } | ||
1888 | */ | ||
1889 | if (DefaultTexture == null) | ||
1890 | { | ||
1891 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); | ||
1892 | DefaultTexture = textu.ToBytes(); | ||
1893 | } | ||
1894 | |||
1895 | List<Guid> animations_work = (List<Guid>)info.GetValue("m_animations", typeof(List<Guid>)); | ||
1896 | |||
1897 | foreach (Guid guid in animations_work) | ||
1898 | { | ||
1899 | m_animations.Add(new LLUUID(guid)); | ||
1900 | } | ||
1901 | |||
1902 | m_animationSeqs = (List<int>)info.GetValue("m_animationSeqs", typeof(List<int>)); | ||
1903 | m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool)); | ||
1904 | m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte)); | ||
1905 | m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>)); | ||
1906 | m_updateCount = (short)info.GetValue("m_updateCount", typeof(short)); | ||
1907 | m_requestedSitTargetID = (uint)info.GetValue("m_requestedSitTargetID", typeof(uint)); | ||
1908 | |||
1909 | m_requestedSitOffset | ||
1910 | = new LLVector3( | ||
1911 | (float)info.GetValue("m_requestedSitOffset.X", typeof(float)), | ||
1912 | (float)info.GetValue("m_requestedSitOffset.Y", typeof(float)), | ||
1913 | (float)info.GetValue("m_requestedSitOffset.Z", typeof(float))); | ||
1914 | |||
1915 | m_sitAvatarHeight = (float)info.GetValue("m_sitAvatarHeight", typeof(float)); | ||
1916 | m_godlevel = (float)info.GetValue("m_godlevel", typeof(float)); | ||
1917 | m_setAlwaysRun = (bool)info.GetValue("m_setAlwaysRun", typeof(bool)); | ||
1918 | |||
1919 | m_bodyRot | ||
1920 | = new Quaternion( | ||
1921 | (float)info.GetValue("m_bodyRot.w", typeof(float)), | ||
1922 | (float)info.GetValue("m_bodyRot.x", typeof(float)), | ||
1923 | (float)info.GetValue("m_bodyRot.y", typeof(float)), | ||
1924 | (float)info.GetValue("m_bodyRot.z", typeof(float))); | ||
1925 | |||
1926 | IsRestrictedToRegion = (bool)info.GetValue("IsRestrictedToRegion", typeof(bool)); | ||
1927 | m_newForce = (bool)info.GetValue("m_newForce", typeof(bool)); | ||
1928 | //m_newAvatar = (bool)info.GetValue("m_newAvatar", typeof(bool)); | ||
1929 | m_newCoarseLocations = (bool)info.GetValue("m_newCoarseLocations", typeof(bool)); | ||
1930 | m_gotAllObjectsInScene = (bool)info.GetValue("m_gotAllObjectsInScene", typeof(bool)); | ||
1931 | m_avHeight = (float)info.GetValue("m_avHeight", typeof(float)); | ||
1932 | crossingFromRegion = (ulong)info.GetValue("crossingFromRegion", typeof(ulong)); | ||
1933 | |||
1934 | List<float[]> Dir_Vectors_work = (List<float[]>)info.GetValue("Dir_Vectors", typeof(List<float[]>)); | ||
1935 | List<Vector3> Dir_Vectors_work2 = new List<Vector3>(); | ||
1936 | |||
1937 | foreach (float[] f3 in Dir_Vectors_work) | ||
1938 | { | ||
1939 | Dir_Vectors_work2.Add(new Vector3(f3[0], f3[1], f3[2])); | ||
1940 | } | ||
1941 | |||
1942 | Dir_Vectors = Dir_Vectors_work2.ToArray(); | ||
1943 | |||
1944 | lastPhysPos | ||
1945 | = new LLVector3( | ||
1946 | (float)info.GetValue("lastPhysPos.X", typeof(float)), | ||
1947 | (float)info.GetValue("lastPhysPos.Y", typeof(float)), | ||
1948 | (float)info.GetValue("lastPhysPos.Z", typeof(float))); | ||
1949 | |||
1950 | m_CameraCenter | ||
1951 | = new Vector3( | ||
1952 | (float)info.GetValue("m_CameraCenter.X", typeof(float)), | ||
1953 | (float)info.GetValue("m_CameraCenter.Y", typeof(float)), | ||
1954 | (float)info.GetValue("m_CameraCenter.Z", typeof(float))); | ||
1955 | |||
1956 | m_CameraAtAxis | ||
1957 | = new Vector3( | ||
1958 | (float)info.GetValue("m_CameraAtAxis.X", typeof(float)), | ||
1959 | (float)info.GetValue("m_CameraAtAxis.Y", typeof(float)), | ||
1960 | (float)info.GetValue("m_CameraAtAxis.Z", typeof(float))); | ||
1961 | |||
1962 | m_CameraLeftAxis | ||
1963 | = new Vector3( | ||
1964 | (float)info.GetValue("m_CameraLeftAxis.X", typeof(float)), | ||
1965 | (float)info.GetValue("m_CameraLeftAxis.Y", typeof(float)), | ||
1966 | (float)info.GetValue("m_CameraLeftAxis.Z", typeof(float))); | ||
1967 | |||
1968 | m_CameraUpAxis | ||
1969 | = new Vector3( | ||
1970 | (float)info.GetValue("m_CameraUpAxis.X", typeof(float)), | ||
1971 | (float)info.GetValue("m_CameraUpAxis.Y", typeof(float)), | ||
1972 | (float)info.GetValue("m_CameraUpAxis.Z", typeof(float))); | ||
1973 | |||
1974 | m_DrawDistance = (float)info.GetValue("m_DrawDistance", typeof(float)); | ||
1975 | m_appearance = (AvatarAppearance)info.GetValue("m_appearance", typeof(AvatarAppearance)); | ||
1976 | m_knownChildRegions = (List<ulong>)info.GetValue("m_knownChildRegions", typeof(List<ulong>)); | ||
1977 | |||
1978 | posLastSignificantMove | ||
1979 | = new LLVector3( | ||
1980 | (float)info.GetValue("posLastSignificantMove.X", typeof(float)), | ||
1981 | (float)info.GetValue("posLastSignificantMove.Y", typeof(float)), | ||
1982 | (float)info.GetValue("posLastSignificantMove.Z", typeof(float))); | ||
1983 | |||
1984 | // m_partsUpdateQueue = (UpdateQueue)info.GetValue("m_partsUpdateQueue", typeof(UpdateQueue)); | ||
1985 | |||
1986 | /* | ||
1987 | Dictionary<Guid, ScenePartUpdate> updateTimes_work | ||
1988 | = (Dictionary<Guid, ScenePartUpdate>)info.GetValue("m_updateTimes", typeof(Dictionary<Guid, ScenePartUpdate>)); | ||
1989 | |||
1990 | foreach (Guid id in updateTimes_work.Keys) | ||
1991 | { | ||
1992 | m_updateTimes.Add(new LLUUID(id), updateTimes_work[id]); | ||
1993 | } | ||
1994 | */ | ||
1995 | m_regionHandle = (ulong)info.GetValue("m_regionHandle", typeof(ulong)); | ||
1996 | m_firstname = (string)info.GetValue("m_firstname", typeof(string)); | ||
1997 | m_lastname = (string)info.GetValue("m_lastname", typeof(string)); | ||
1998 | m_allowMovement = (bool)info.GetValue("m_allowMovement", typeof(bool)); | ||
1999 | m_parentPosition = new LLVector3((float)info.GetValue("m_parentPosition.X", typeof(float)), | ||
2000 | (float)info.GetValue("m_parentPosition.Y", typeof(float)), | ||
2001 | (float)info.GetValue("m_parentPosition.Z", typeof(float))); | ||
2002 | |||
2003 | m_isChildAgent = (bool)info.GetValue("m_isChildAgent", typeof(bool)); | ||
2004 | m_parentID = (uint)info.GetValue("m_parentID", typeof(uint)); | ||
2005 | |||
2006 | // for OpenSim_v0.5 | ||
2007 | currentParcelUUID = new LLUUID((Guid)info.GetValue("currentParcelUUID", typeof(Guid))); | ||
2008 | |||
2009 | lastKnownAllowedPosition | ||
2010 | = new Vector3( | ||
2011 | (float)info.GetValue("lastKnownAllowedPosition.X", typeof(float)), | ||
2012 | (float)info.GetValue("lastKnownAllowedPosition.Y", typeof(float)), | ||
2013 | (float)info.GetValue("lastKnownAllowedPosition.Z", typeof(float))); | ||
2014 | |||
2015 | sentMessageAboutRestrictedParcelFlyingDown = (bool)info.GetValue("sentMessageAboutRestrictedParcelFlyingDown", typeof(bool)); | ||
2016 | |||
2017 | m_LastChildAgentUpdatePosition | ||
2018 | = new LLVector3( | ||
2019 | (float)info.GetValue("m_LastChildAgentUpdatePosition.X", typeof(float)), | ||
2020 | (float)info.GetValue("m_LastChildAgentUpdatePosition.Y", typeof(float)), | ||
2021 | (float)info.GetValue("m_LastChildAgentUpdatePosition.Z", typeof(float))); | ||
2022 | |||
2023 | m_perfMonMS = (int)info.GetValue("m_perfMonMS", typeof(int)); | ||
2024 | m_AgentControlFlags = (uint)info.GetValue("m_AgentControlFlags", typeof(uint)); | ||
2025 | |||
2026 | m_headrotation | ||
2027 | = new LLQuaternion( | ||
2028 | (float)info.GetValue("m_headrotation.W", typeof(float)), | ||
2029 | (float)info.GetValue("m_headrotation.X", typeof(float)), | ||
2030 | (float)info.GetValue("m_headrotation.Y", typeof(float)), | ||
2031 | (float)info.GetValue("m_headrotation.Z", typeof(float))); | ||
2032 | |||
2033 | m_state = (byte)info.GetValue("m_state", typeof(byte)); | ||
2034 | |||
2035 | List<Guid> knownPrimUUID_work = (List<Guid>)info.GetValue("m_knownPrimUUID", typeof(List<Guid>)); | ||
2036 | |||
2037 | foreach (Guid id in knownPrimUUID_work) | ||
2038 | { | ||
2039 | m_knownPrimUUID.Add(new LLUUID(id)); | ||
2040 | } | ||
2041 | |||
2042 | //System.Console.WriteLine("ScenePresence Deserialize END"); | ||
2043 | } | ||
2044 | |||
2045 | [SecurityPermission(SecurityAction.LinkDemand, | ||
2046 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
2047 | public override void GetObjectData( | ||
2048 | SerializationInfo info, StreamingContext context) | ||
2049 | { | ||
2050 | if (info == null) | ||
2051 | { | ||
2052 | throw new System.ArgumentNullException("info"); | ||
2053 | } | ||
2054 | |||
2055 | base.GetObjectData(info, context); | ||
2056 | |||
2057 | List<Guid> animations_work = new List<Guid>(); | ||
2058 | |||
2059 | foreach (LLUUID uuid in m_animations) | ||
2060 | { | ||
2061 | animations_work.Add(uuid.UUID); | ||
2062 | } | ||
2063 | |||
2064 | info.AddValue("m_animations", animations_work); | ||
2065 | |||
2066 | info.AddValue("m_animationSeqs", m_animationSeqs); | ||
2067 | info.AddValue("m_updateflag", m_updateflag); | ||
2068 | info.AddValue("m_movementflag", m_movementflag); | ||
2069 | info.AddValue("m_forcesList", m_forcesList); | ||
2070 | info.AddValue("m_updateCount", m_updateCount); | ||
2071 | info.AddValue("m_requestedSitTargetID", m_requestedSitTargetID); | ||
2072 | |||
2073 | // LLVector3 | ||
2074 | info.AddValue("m_requestedSitOffset.X", m_requestedSitOffset.X); | ||
2075 | info.AddValue("m_requestedSitOffset.Y", m_requestedSitOffset.Y); | ||
2076 | info.AddValue("m_requestedSitOffset.Z", m_requestedSitOffset.Z); | ||
2077 | |||
2078 | info.AddValue("m_sitAvatarHeight", m_sitAvatarHeight); | ||
2079 | info.AddValue("m_godlevel", m_godlevel); | ||
2080 | info.AddValue("m_setAlwaysRun", m_setAlwaysRun); | ||
2081 | |||
2082 | // Quaternion | ||
2083 | info.AddValue("m_bodyRot.w", m_bodyRot.w); | ||
2084 | info.AddValue("m_bodyRot.x", m_bodyRot.x); | ||
2085 | info.AddValue("m_bodyRot.y", m_bodyRot.y); | ||
2086 | info.AddValue("m_bodyRot.z", m_bodyRot.z); | ||
2087 | |||
2088 | info.AddValue("IsRestrictedToRegion", IsRestrictedToRegion); | ||
2089 | info.AddValue("m_newForce", m_newForce); | ||
2090 | //info.AddValue("m_newAvatar", m_newAvatar); | ||
2091 | info.AddValue("m_newCoarseLocations", m_newCoarseLocations); | ||
2092 | info.AddValue("m_gotAllObjectsInScene", m_gotAllObjectsInScene); | ||
2093 | info.AddValue("m_avHeight", m_avHeight); | ||
2094 | |||
2095 | // info.AddValue("m_regionInfo", m_regionInfo); | ||
2096 | |||
2097 | info.AddValue("crossingFromRegion", crossingFromRegion); | ||
2098 | |||
2099 | List<float[]> Dir_Vectors_work = new List<float[]>(); | ||
2100 | |||
2101 | foreach (Vector3 v3 in Dir_Vectors) | ||
2102 | { | ||
2103 | Dir_Vectors_work.Add(new float[] { v3.x, v3.y, v3.z }); | ||
2104 | } | ||
2105 | |||
2106 | info.AddValue("Dir_Vectors", Dir_Vectors_work); | ||
2107 | |||
2108 | // LLVector3 | ||
2109 | info.AddValue("lastPhysPos.X", lastPhysPos.X); | ||
2110 | info.AddValue("lastPhysPos.Y", lastPhysPos.Y); | ||
2111 | info.AddValue("lastPhysPos.Z", lastPhysPos.Z); | ||
2112 | |||
2113 | // Vector3 | ||
2114 | info.AddValue("m_CameraCenter.X", m_CameraCenter.x); | ||
2115 | info.AddValue("m_CameraCenter.Y", m_CameraCenter.y); | ||
2116 | info.AddValue("m_CameraCenter.Z", m_CameraCenter.z); | ||
2117 | |||
2118 | // Vector3 | ||
2119 | info.AddValue("m_CameraAtAxis.X", m_CameraAtAxis.x); | ||
2120 | info.AddValue("m_CameraAtAxis.Y", m_CameraAtAxis.y); | ||
2121 | info.AddValue("m_CameraAtAxis.Z", m_CameraAtAxis.z); | ||
2122 | |||
2123 | // Vector3 | ||
2124 | info.AddValue("m_CameraLeftAxis.X", m_CameraLeftAxis.x); | ||
2125 | info.AddValue("m_CameraLeftAxis.Y", m_CameraLeftAxis.y); | ||
2126 | info.AddValue("m_CameraLeftAxis.Z", m_CameraLeftAxis.z); | ||
2127 | |||
2128 | // Vector3 | ||
2129 | info.AddValue("m_CameraUpAxis.X", m_CameraUpAxis.x); | ||
2130 | info.AddValue("m_CameraUpAxis.Y", m_CameraUpAxis.y); | ||
2131 | info.AddValue("m_CameraUpAxis.Z", m_CameraUpAxis.z); | ||
2132 | |||
2133 | info.AddValue("m_DrawDistance", m_DrawDistance); | ||
2134 | info.AddValue("m_appearance", m_appearance); | ||
2135 | info.AddValue("m_knownChildRegions", m_knownChildRegions); | ||
2136 | |||
2137 | // LLVector3 | ||
2138 | info.AddValue("posLastSignificantMove.X", posLastSignificantMove.X); | ||
2139 | info.AddValue("posLastSignificantMove.Y", posLastSignificantMove.Y); | ||
2140 | info.AddValue("posLastSignificantMove.Z", posLastSignificantMove.Z); | ||
2141 | |||
2142 | //info.AddValue("m_partsUpdateQueue", m_partsUpdateQueue); | ||
2143 | |||
2144 | /* | ||
2145 | Dictionary<Guid, ScenePartUpdate> updateTimes_work = new Dictionary<Guid, ScenePartUpdate>(); | ||
2146 | |||
2147 | foreach ( LLUUID id in m_updateTimes.Keys) | ||
2148 | { | ||
2149 | updateTimes_work.Add(id.UUID, m_updateTimes[id]); | ||
2150 | } | ||
2151 | |||
2152 | info.AddValue("m_updateTimes", updateTimes_work); | ||
2153 | */ | ||
2154 | |||
2155 | info.AddValue("m_regionHandle", m_regionHandle); | ||
2156 | info.AddValue("m_firstname", m_firstname); | ||
2157 | info.AddValue("m_lastname", m_lastname); | ||
2158 | info.AddValue("m_allowMovement", m_allowMovement); | ||
2159 | //info.AddValue("m_physicsActor", m_physicsActor); | ||
2160 | info.AddValue("m_parentPosition.X", m_parentPosition.X); | ||
2161 | info.AddValue("m_parentPosition.Y", m_parentPosition.Y); | ||
2162 | info.AddValue("m_parentPosition.Z", m_parentPosition.Z); | ||
2163 | info.AddValue("m_isChildAgent", m_isChildAgent); | ||
2164 | info.AddValue("m_parentID", m_parentID); | ||
2165 | |||
2166 | // for OpenSim_v0.5 | ||
2167 | info.AddValue("currentParcelUUID", currentParcelUUID.UUID); | ||
2168 | |||
2169 | info.AddValue("lastKnownAllowedPosition.X", lastKnownAllowedPosition.x); | ||
2170 | info.AddValue("lastKnownAllowedPosition.Y", lastKnownAllowedPosition.y); | ||
2171 | info.AddValue("lastKnownAllowedPosition.Z", lastKnownAllowedPosition.z); | ||
2172 | |||
2173 | info.AddValue("sentMessageAboutRestrictedParcelFlyingDown", sentMessageAboutRestrictedParcelFlyingDown); | ||
2174 | |||
2175 | info.AddValue("m_LastChildAgentUpdatePosition.X", m_LastChildAgentUpdatePosition.X); | ||
2176 | info.AddValue("m_LastChildAgentUpdatePosition.Y", m_LastChildAgentUpdatePosition.Y); | ||
2177 | info.AddValue("m_LastChildAgentUpdatePosition.Z", m_LastChildAgentUpdatePosition.Z); | ||
2178 | |||
2179 | info.AddValue("m_perfMonMS", m_perfMonMS); | ||
2180 | info.AddValue("m_AgentControlFlags", m_AgentControlFlags); | ||
2181 | |||
2182 | info.AddValue("m_headrotation.W", m_headrotation.W); | ||
2183 | info.AddValue("m_headrotation.X", m_headrotation.X); | ||
2184 | info.AddValue("m_headrotation.Y", m_headrotation.Y); | ||
2185 | info.AddValue("m_headrotation.Z", m_headrotation.Z); | ||
2186 | |||
2187 | info.AddValue("m_state", m_state); | ||
2188 | |||
2189 | List<Guid> knownPrimUUID_work = new List<Guid>(); | ||
2190 | |||
2191 | foreach (LLUUID id in m_knownPrimUUID) | ||
2192 | { | ||
2193 | knownPrimUUID_work.Add(id.UUID); | ||
2194 | } | ||
2195 | |||
2196 | info.AddValue("m_knownPrimUUID", knownPrimUUID_work); | ||
2197 | } | ||
1790 | } | 2198 | } |
1791 | } | 2199 | } |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index 0078678..ce0927c 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -30,9 +30,14 @@ using System.Collections.Generic; | |||
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | 32 | ||
33 | using System; | ||
34 | using System.Runtime.Serialization; | ||
35 | using System.Security.Permissions; | ||
36 | |||
33 | namespace OpenSim.Region.Environment.Types | 37 | namespace OpenSim.Region.Environment.Types |
34 | { | 38 | { |
35 | public class UpdateQueue | 39 | [Serializable] |
40 | public class UpdateQueue : ISerializable | ||
36 | { | 41 | { |
37 | private Queue<SceneObjectPart> m_queue; | 42 | private Queue<SceneObjectPart> m_queue; |
38 | 43 | ||
@@ -86,5 +91,46 @@ namespace OpenSim.Region.Environment.Types | |||
86 | 91 | ||
87 | return part; | 92 | return part; |
88 | } | 93 | } |
94 | |||
95 | protected UpdateQueue(SerializationInfo info, StreamingContext context) | ||
96 | { | ||
97 | //System.Console.WriteLine("UpdateQueue Deserialize BGN"); | ||
98 | |||
99 | if (info == null) | ||
100 | { | ||
101 | throw new System.ArgumentNullException("info"); | ||
102 | } | ||
103 | |||
104 | m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>)); | ||
105 | List<Guid> ids_work = (List<Guid>)info.GetValue("m_ids", typeof(List<Guid>)); | ||
106 | |||
107 | foreach (Guid guid in ids_work) | ||
108 | { | ||
109 | m_ids.Add(new LLUUID(guid)); | ||
110 | } | ||
111 | |||
112 | //System.Console.WriteLine("UpdateQueue Deserialize END"); | ||
113 | } | ||
114 | |||
115 | [SecurityPermission(SecurityAction.LinkDemand, | ||
116 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
117 | public virtual void GetObjectData( | ||
118 | SerializationInfo info, StreamingContext context) | ||
119 | { | ||
120 | if (info == null) | ||
121 | { | ||
122 | throw new System.ArgumentNullException("info"); | ||
123 | } | ||
124 | |||
125 | List<Guid> ids_work = new List<Guid>(); | ||
126 | |||
127 | foreach (LLUUID uuid in m_ids) | ||
128 | { | ||
129 | ids_work.Add(uuid.UUID); | ||
130 | } | ||
131 | |||
132 | info.AddValue("m_queue", m_queue); | ||
133 | info.AddValue("m_ids", ids_work); | ||
134 | } | ||
89 | } | 135 | } |
90 | } \ No newline at end of file | 136 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index cb2c908..68fea97 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -538,5 +538,18 @@ namespace SimpleApp | |||
538 | public void SendLogoutPacket() | 538 | public void SendLogoutPacket() |
539 | { | 539 | { |
540 | } | 540 | } |
541 | |||
542 | public void Terminate() | ||
543 | { | ||
544 | } | ||
545 | |||
546 | public ClientInfo GetClientInfo() | ||
547 | { | ||
548 | return null; | ||
549 | } | ||
550 | |||
551 | public void SetClientInfo(ClientInfo info) | ||
552 | { | ||
553 | } | ||
541 | } | 554 | } |
542 | } | 555 | } |