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 | |
parent | Added copyright heaaders. Minor cleanup. (diff) | |
download | opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.zip opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.gz opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.bz2 opensim-SC-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')
34 files changed, 1647 insertions, 125 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index ff88021..07c9def 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
66 | for (int i = 0; i < regionsToLoad.Length; i++) | 66 | for (int i = 0; i < regionsToLoad.Length; i++) |
67 | { | 67 | { |
68 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); | 68 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); |
69 | openSim.CreateRegion(regionsToLoad[i]); | 69 | openSim.CreateRegion(regionsToLoad[i], true); |
70 | } | 70 | } |
71 | 71 | ||
72 | openSim.ModuleLoader.PostInitialise(); | 72 | openSim.ModuleLoader.PostInitialise(); |
@@ -96,7 +96,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
96 | if (regionhandle == regionsToLoad[i].RegionHandle) | 96 | if (regionhandle == regionsToLoad[i].RegionHandle) |
97 | { | 97 | { |
98 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); | 98 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ")"); |
99 | openSim.CreateRegion(regionsToLoad[i]); | 99 | openSim.CreateRegion(regionsToLoad[i], true); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | } | 102 | } |
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 005bfd7..fba0c3b 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -269,7 +269,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
269 | newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"]; | 269 | newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"]; |
270 | newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"]; | 270 | newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"]; |
271 | 271 | ||
272 | m_app.CreateRegion(newRegionData); | 272 | m_app.CreateRegion(newRegionData, true); |
273 | 273 | ||
274 | responseData["created"] = "true"; | 274 | responseData["created"] = "true"; |
275 | response.Value = responseData; | 275 | response.Value = responseData; |
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index c7083f3..e7c2338 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs | |||
@@ -26,10 +26,14 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using System; | ||
30 | using System.Runtime.Serialization; | ||
31 | using System.Security.Permissions; | ||
29 | 32 | ||
30 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
31 | { | 34 | { |
32 | public class AvatarWearable | 35 | [Serializable] |
36 | public class AvatarWearable : ISerializable | ||
33 | { | 37 | { |
34 | public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 38 | public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
35 | public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 39 | public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
@@ -67,5 +71,32 @@ namespace OpenSim.Framework | |||
67 | return defaultWearables; | 71 | return defaultWearables; |
68 | } | 72 | } |
69 | } | 73 | } |
74 | protected AvatarWearable(SerializationInfo info, StreamingContext context) | ||
75 | { | ||
76 | //System.Console.WriteLine("AvatarWearable Deserialize BGN"); | ||
77 | if (info == null) | ||
78 | { | ||
79 | throw new System.ArgumentNullException("info"); | ||
80 | } | ||
81 | |||
82 | AssetID = new LLUUID((Guid)info.GetValue("AssetID", typeof(Guid))); | ||
83 | ItemID = new LLUUID((Guid)info.GetValue("ItemID", typeof(Guid))); | ||
84 | |||
85 | //System.Console.WriteLine("AvatarWearable Deserialize END"); | ||
86 | } | ||
87 | |||
88 | [SecurityPermission(SecurityAction.LinkDemand, | ||
89 | Flags = SecurityPermissionFlag.SerializationFormatter)] | ||
90 | public virtual void GetObjectData( | ||
91 | SerializationInfo info, StreamingContext context) | ||
92 | { | ||
93 | if (info == null) | ||
94 | { | ||
95 | throw new System.ArgumentNullException("info"); | ||
96 | } | ||
97 | |||
98 | info.AddValue("AssetID", AssetID.UUID); | ||
99 | info.AddValue("ItemID", ItemID.UUID); | ||
100 | } | ||
70 | } | 101 | } |
71 | } \ No newline at end of file | 102 | } |
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index e72884c..6f56782 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs | |||
@@ -69,5 +69,10 @@ namespace OpenSim.Framework | |||
69 | { | 69 | { |
70 | return m_queue.Count; | 70 | return m_queue.Count; |
71 | } | 71 | } |
72 | |||
73 | public T[] GetQueueArray() | ||
74 | { | ||
75 | return m_queue.ToArray(); | ||
76 | } | ||
72 | } | 77 | } |
73 | } | 78 | } |
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index cfdcbf0..39d8d99 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Framework | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | private uint[] GetAllCircuits(LLUUID agentId) | 140 | public uint[] GetAllCircuits(LLUUID agentId) |
141 | { | 141 | { |
142 | List<uint> circuits = new List<uint>(); | 142 | List<uint> circuits = new List<uint>(); |
143 | // Wasteful, I know | 143 | // Wasteful, I know |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 3737e48..eefb4e9 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs | |||
@@ -97,6 +97,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
97 | database.ExecuteResourceSql("CreateRegionsTable.sql"); | 97 | database.ExecuteResourceSql("CreateRegionsTable.sql"); |
98 | return; | 98 | return; |
99 | } | 99 | } |
100 | else if (oldVersion.Contains("Rev. 1")) | ||
101 | { | ||
102 | database.ExecuteResourceSql("UpgradeRegionsTableToVersion2.sql"); | ||
103 | return; | ||
104 | } | ||
100 | } | 105 | } |
101 | 106 | ||
102 | #endregion | 107 | #endregion |
@@ -260,6 +265,27 @@ namespace OpenSim.Framework.Data.MySQL | |||
260 | } | 265 | } |
261 | 266 | ||
262 | /// <summary> | 267 | /// <summary> |
268 | /// Deletes a profile from the database | ||
269 | /// </summary> | ||
270 | /// <param name="profile">The profile to delete</param> | ||
271 | /// <returns>Successful?</returns> | ||
272 | //public DataResponse DeleteProfile(RegionProfileData profile) | ||
273 | public DataResponse DeleteProfile(string uuid) | ||
274 | { | ||
275 | lock (database) | ||
276 | { | ||
277 | if (database.deleteRegion(uuid)) | ||
278 | { | ||
279 | return DataResponse.RESPONSE_OK; | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | return DataResponse.RESPONSE_ERROR; | ||
284 | } | ||
285 | } | ||
286 | } | ||
287 | |||
288 | /// <summary> | ||
263 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | 289 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. |
264 | /// </summary> | 290 | /// </summary> |
265 | /// <param name="uuid">The UUID of the challenger</param> | 291 | /// <param name="uuid">The UUID of the challenger</param> |
@@ -328,4 +354,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
328 | } | 354 | } |
329 | } | 355 | } |
330 | } | 356 | } |
331 | } \ No newline at end of file | 357 | } |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index ea11aa0..0410643 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs | |||
@@ -301,6 +301,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
301 | 301 | ||
302 | // non-critical parts | 302 | // non-critical parts |
303 | retval.regionName = (string)reader["regionName"]; | 303 | retval.regionName = (string)reader["regionName"]; |
304 | retval.originUUID = new LLUUID((string) reader["originUUID"]); | ||
304 | 305 | ||
305 | // Secrets | 306 | // Secrets |
306 | retval.regionRecvKey = (string) reader["regionRecvKey"]; | 307 | retval.regionRecvKey = (string) reader["regionRecvKey"]; |
@@ -752,13 +753,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
752 | // server for the UUID of the region's owner (master avatar). It consists of the addition of the column and value to the relevant sql, | 753 | // server for the UUID of the region's owner (master avatar). It consists of the addition of the column and value to the relevant sql, |
753 | // as well as the related parameterization | 754 | // as well as the related parameterization |
754 | sql += | 755 | sql += |
755 | "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid) VALUES "; | 756 | "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID) VALUES "; |
756 | 757 | ||
757 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; | 758 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; |
758 | sql += | 759 | sql += |
759 | "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; | 760 | "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; |
760 | sql += | 761 | sql += |
761 | "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid)"; | 762 | "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid, ?originUUID)"; |
762 | 763 | ||
763 | if (GRID_ONLY_UPDATE_NECESSARY_DATA) | 764 | if (GRID_ONLY_UPDATE_NECESSARY_DATA) |
764 | { | 765 | { |
@@ -798,6 +799,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
798 | parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); | 799 | parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); |
799 | parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); | 800 | parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); |
800 | parameters["?owner_uuid"] = regiondata.owner_uuid.ToString(); | 801 | parameters["?owner_uuid"] = regiondata.owner_uuid.ToString(); |
802 | parameters["?originUUID"] = regiondata.originUUID.ToString(); | ||
801 | 803 | ||
802 | bool returnval = false; | 804 | bool returnval = false; |
803 | 805 | ||
@@ -821,5 +823,41 @@ namespace OpenSim.Framework.Data.MySQL | |||
821 | 823 | ||
822 | return returnval; | 824 | return returnval; |
823 | } | 825 | } |
826 | /// <summary> | ||
827 | /// Delete a region from the database | ||
828 | /// </summary> | ||
829 | /// <param name="profile">The region to insert</param> | ||
830 | /// <returns>Success?</returns> | ||
831 | //public bool deleteRegion(RegionProfileData regiondata) | ||
832 | public bool deleteRegion(string uuid) | ||
833 | { | ||
834 | bool returnval = false; | ||
835 | |||
836 | string sql = | ||
837 | "DELETE FROM regions WHERE uuid = ?uuid;"; | ||
838 | |||
839 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
840 | |||
841 | try | ||
842 | { | ||
843 | parameters["?uuid"] = uuid; | ||
844 | |||
845 | IDbCommand result = Query(sql, parameters); | ||
846 | |||
847 | int x; | ||
848 | if ((x = result.ExecuteNonQuery()) > 0) | ||
849 | { | ||
850 | returnval = true; | ||
851 | } | ||
852 | result.Dispose(); | ||
853 | } | ||
854 | catch (Exception e) | ||
855 | { | ||
856 | m_log.Error(e.ToString()); | ||
857 | return false; | ||
858 | } | ||
859 | |||
860 | return returnval; | ||
861 | } | ||
824 | } | 862 | } |
825 | } | 863 | } |
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql index 07b0d9b..23535af 100644 --- a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql +++ b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql | |||
@@ -23,8 +23,9 @@ CREATE TABLE `regions` ( | |||
23 | `regionUserRecvKey` varchar(128) default NULL, | 23 | `regionUserRecvKey` varchar(128) default NULL, |
24 | `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, | 24 | `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, |
25 | `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, | 25 | `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, |
26 | `originUUID` varchar(36), | ||
26 | PRIMARY KEY (`uuid`), | 27 | PRIMARY KEY (`uuid`), |
27 | KEY `regionName` (`regionName`), | 28 | KEY `regionName` (`regionName`), |
28 | KEY `regionHandle` (`regionHandle`), | 29 | KEY `regionHandle` (`regionHandle`), |
29 | KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) | 30 | KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) |
30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 1'; | 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 2'; |
diff --git a/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql new file mode 100644 index 0000000..5880954 --- /dev/null +++ b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql | |||
@@ -0,0 +1,3 @@ | |||
1 | ALTER TABLE `regions` | ||
2 | ADD COLUMN `originUUID` varchar(36), | ||
3 | COMMENT='Rev. 2'; | ||
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index f9f4283..e4b48b7 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs | |||
@@ -130,6 +130,12 @@ namespace OpenSim.Framework.Data | |||
130 | public LLUUID owner_uuid = LLUUID.Zero; | 130 | public LLUUID owner_uuid = LLUUID.Zero; |
131 | 131 | ||
132 | /// <summary> | 132 | /// <summary> |
133 | /// OGS/OpenSim Specific original ID for a region after move/split | ||
134 | /// </summary> | ||
135 | public LLUUID originUUID; | ||
136 | |||
137 | |||
138 | /// <summary> | ||
133 | /// Get Sim profile data from grid server when in grid mode | 139 | /// Get Sim profile data from grid server when in grid mode |
134 | /// </summary> | 140 | /// </summary> |
135 | /// <param name="region_uuid"></param> | 141 | /// <param name="region_uuid"></param> |
@@ -162,7 +168,7 @@ namespace OpenSim.Framework.Data | |||
162 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); | 168 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); |
163 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | 169 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); |
164 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | 170 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); |
165 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 171 | simData.serverURI = (string)responseData["server_uri"]; |
166 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 172 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
167 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); | 173 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); |
168 | simData.regionName = (string) responseData["region_name"]; | 174 | simData.regionName = (string) responseData["region_name"]; |
@@ -205,7 +211,7 @@ namespace OpenSim.Framework.Data | |||
205 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | 211 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); |
206 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | 212 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); |
207 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | 213 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; |
208 | simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; | 214 | simData.serverURI = (string)responseData["server_uri"]; |
209 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); | 215 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); |
210 | simData.regionName = (string) responseData["region_name"]; | 216 | simData.regionName = (string) responseData["region_name"]; |
211 | 217 | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5001f00..7a0a232 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -665,5 +665,24 @@ namespace OpenSim.Framework | |||
665 | void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message); | 665 | void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message); |
666 | 666 | ||
667 | void SendLogoutPacket(); | 667 | void SendLogoutPacket(); |
668 | ClientInfo GetClientInfo(); | ||
669 | void SetClientInfo(ClientInfo info); | ||
670 | void Terminate(); | ||
671 | } | ||
672 | |||
673 | [Serializable] | ||
674 | public class ClientInfo | ||
675 | { | ||
676 | public byte[] usecircuit; | ||
677 | public EndPoint userEP; | ||
678 | public EndPoint proxyEP; | ||
679 | public sAgentCircuitData agentcircuit; | ||
680 | |||
681 | public Dictionary<uint, uint> pendingAcks; | ||
682 | public Dictionary<uint, byte[]> needAck; | ||
683 | |||
684 | public List<byte[]> out_packets; | ||
685 | |||
686 | public uint sequence; | ||
668 | } | 687 | } |
669 | } | 688 | } |
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 3445050..0bb0efb 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs | |||
@@ -38,7 +38,8 @@ namespace OpenSim.Framework | |||
38 | Down = 0, | 38 | Down = 0, |
39 | Up = 1, | 39 | Up = 1, |
40 | Crashed = 2, | 40 | Crashed = 2, |
41 | Starting = 3 | 41 | Starting = 3, |
42 | SlaveScene = 4 | ||
42 | } ; | 43 | } ; |
43 | 44 | ||
44 | public interface IScene | 45 | public interface IScene |
@@ -63,4 +64,4 @@ namespace OpenSim.Framework | |||
63 | 64 | ||
64 | ClientManager ClientManager { get; } | 65 | ClientManager ClientManager { get; } |
65 | } | 66 | } |
66 | } \ No newline at end of file | 67 | } |
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs index 30b6d6a..2c44ae3 100644 --- a/OpenSim/Framework/PacketPool.cs +++ b/OpenSim/Framework/PacketPool.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Net; | ||
29 | using System.Collections; | 30 | using System.Collections; |
30 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
31 | 32 | ||
@@ -33,29 +34,68 @@ namespace OpenSim.Framework | |||
33 | { | 34 | { |
34 | public sealed class PacketPool | 35 | public sealed class PacketPool |
35 | { | 36 | { |
37 | static public void EncodeProxyMessage(byte[] bytes, ref int numBytes, EndPoint trueEP) | ||
38 | { | ||
39 | if( numBytes > 4090 ) // max UPD size = 4096 | ||
40 | { | ||
41 | throw new Exception("ERROR: No space to encode the proxy EP"); | ||
42 | } | ||
43 | |||
44 | ushort port = (ushort) ((IPEndPoint) trueEP).Port; | ||
45 | bytes[numBytes++] = (byte)(port % 256); | ||
46 | bytes[numBytes++] = (byte)(port / 256); | ||
47 | |||
48 | foreach (byte b in ((IPEndPoint)trueEP).Address.GetAddressBytes()) | ||
49 | { | ||
50 | bytes[numBytes++] = b; | ||
51 | } | ||
52 | |||
53 | int x = numBytes; | ||
54 | |||
55 | DecodeProxyMessage(bytes, ref numBytes); | ||
56 | |||
57 | numBytes = x; | ||
58 | } | ||
59 | |||
60 | static public EndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes) | ||
61 | { | ||
62 | // IPv4 Only | ||
63 | byte[] addr = new byte[4]; | ||
64 | |||
65 | addr[3] = bytes[--numBytes]; | ||
66 | addr[2] = bytes[--numBytes]; | ||
67 | addr[1] = bytes[--numBytes]; | ||
68 | addr[0] = bytes[--numBytes]; | ||
69 | |||
70 | ushort port = (ushort)(bytes[--numBytes] * 256); | ||
71 | port += (ushort)bytes[--numBytes]; | ||
72 | |||
73 | return (EndPoint) new IPEndPoint(new IPAddress(addr), (int)port); | ||
74 | } | ||
75 | |||
36 | // Set up a thread-safe singleton pattern | 76 | // Set up a thread-safe singleton pattern |
37 | static PacketPool() | 77 | static PacketPool() |
38 | { | 78 | { |
39 | } | 79 | } |
40 | 80 | ||
41 | private static readonly PacketPool instance = new PacketPool(); | 81 | static readonly PacketPool instance = new PacketPool(); |
42 | 82 | ||
43 | public static PacketPool Instance | 83 | public static PacketPool Instance |
44 | { | 84 | { |
45 | get { return instance; } | 85 | get |
86 | { | ||
87 | return instance; | ||
88 | } | ||
46 | } | 89 | } |
47 | 90 | ||
48 | private Hashtable pool = new Hashtable(); | 91 | private Hashtable pool = new Hashtable(); |
49 | 92 | ||
50 | public Packet GetPacket(PacketType type) | 93 | public Packet GetPacket(PacketType type) { |
51 | { | ||
52 | return Packet.BuildPacket(type); | ||
53 | /* Skip until PacketPool performance problems have been resolved (mantis 281) | ||
54 | Packet packet = null; | 94 | Packet packet = null; |
55 | 95 | ||
56 | lock (pool) | 96 | lock(pool) |
57 | { | 97 | { |
58 | if (pool[type] == null || ((Stack) pool[type]).Count == 0) | 98 | if(pool[type] == null || ((Stack) pool[type]).Count == 0) |
59 | { | 99 | { |
60 | // Creating a new packet if we cannot reuse an old package | 100 | // Creating a new packet if we cannot reuse an old package |
61 | packet = Packet.BuildPacket(type); | 101 | packet = Packet.BuildPacket(type); |
@@ -63,39 +103,16 @@ namespace OpenSim.Framework | |||
63 | else | 103 | else |
64 | { | 104 | { |
65 | // Recycle old packages | 105 | // Recycle old packages |
66 | packet = (Packet) ((Stack) pool[type]).Pop(); | 106 | packet=(Packet) ((Stack) pool[type]).Pop(); |
67 | } | 107 | } |
68 | } | 108 | } |
69 | 109 | ||
70 | return packet; | 110 | return packet; |
71 | */ | ||
72 | } | ||
73 | |||
74 | // Copied from LibSL, and added a check to avoid overwriting the | ||
75 | // buffer | ||
76 | private void ZeroDecodeCommand(byte[] src, byte[] dest) | ||
77 | { | ||
78 | for (int srcPos = 6, destPos = 6; destPos < 10; ++srcPos) | ||
79 | { | ||
80 | if (src[srcPos] == 0x00) | ||
81 | { | ||
82 | for (byte j = 0; j < src[srcPos + 1] && destPos < 10; ++j) | ||
83 | { | ||
84 | dest[destPos++] = 0x00; | ||
85 | } | ||
86 | ++srcPos; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | dest[destPos++] = src[srcPos]; | ||
91 | } | ||
92 | } | ||
93 | } | 111 | } |
94 | 112 | ||
113 | private byte[] decoded_header = new byte[10]; | ||
95 | private PacketType GetType(byte[] bytes) | 114 | private PacketType GetType(byte[] bytes) |
96 | { | 115 | { |
97 | byte[] decoded_header = new byte[10]; | ||
98 | |||
99 | ushort id; | 116 | ushort id; |
100 | libsecondlife.PacketFrequency freq; | 117 | libsecondlife.PacketFrequency freq; |
101 | 118 | ||
@@ -103,7 +120,7 @@ namespace OpenSim.Framework | |||
103 | 120 | ||
104 | if((bytes[0] & libsecondlife.Helpers.MSG_ZEROCODED)!=0) | 121 | if((bytes[0] & libsecondlife.Helpers.MSG_ZEROCODED)!=0) |
105 | { | 122 | { |
106 | ZeroDecodeCommand(bytes, decoded_header); | 123 | libsecondlife.Helpers.ZeroDecodeCommand(bytes, decoded_header); |
107 | } | 124 | } |
108 | 125 | ||
109 | if (decoded_header[6] == 0xFF) | 126 | if (decoded_header[6] == 0xFF) |
@@ -138,21 +155,22 @@ namespace OpenSim.Framework | |||
138 | return packet; | 155 | return packet; |
139 | } | 156 | } |
140 | 157 | ||
141 | public void ReturnPacket(Packet packet) | 158 | public void ReturnPacket(Packet packet) { |
142 | { | 159 | return; // packet pool disabled |
143 | /* Skip until PacketPool performance problems have been resolved (mantis 281) | 160 | |
144 | lock (pool) | 161 | lock(pool) |
145 | { | 162 | { |
146 | PacketType type = packet.Type; | 163 | PacketType type=packet.Type; |
147 | 164 | ||
148 | if (pool[type] == null) | 165 | if(pool[type] == null) |
149 | { | 166 | { |
150 | pool[type] = new Stack(); | 167 | pool[type] = new Stack(); |
151 | } | 168 | } |
152 | 169 | if (((Stack)pool[type]).Count < 50) | |
153 | ((Stack) pool[type]).Push(packet); | 170 | { |
171 | ((Stack)pool[type]).Push(packet); | ||
172 | } | ||
154 | } | 173 | } |
155 | */ | ||
156 | } | 174 | } |
157 | } | 175 | } |
158 | } | 176 | } |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index f97db5c..43e2a24 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -71,6 +71,7 @@ namespace OpenSim.Framework | |||
71 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | 71 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; |
72 | RemotingAddress = ConvertFrom.RemotingAddress; | 72 | RemotingAddress = ConvertFrom.RemotingAddress; |
73 | RegionID = LLUUID.Zero; | 73 | RegionID = LLUUID.Zero; |
74 | ServerURI = ConvertFrom.ServerURI; | ||
74 | } | 75 | } |
75 | 76 | ||
76 | public LLUUID RegionID = LLUUID.Zero; | 77 | public LLUUID RegionID = LLUUID.Zero; |
@@ -84,6 +85,19 @@ namespace OpenSim.Framework | |||
84 | } | 85 | } |
85 | public bool m_allow_alternate_ports; | 86 | public bool m_allow_alternate_ports; |
86 | 87 | ||
88 | public string m_serverURI; | ||
89 | public string ServerURI | ||
90 | { | ||
91 | get | ||
92 | { | ||
93 | return m_serverURI; | ||
94 | } | ||
95 | set | ||
96 | { | ||
97 | m_serverURI = value; | ||
98 | } | ||
99 | } | ||
100 | |||
87 | public string RemotingAddress; | 101 | public string RemotingAddress; |
88 | 102 | ||
89 | public IPEndPoint ExternalEndPoint | 103 | public IPEndPoint ExternalEndPoint |
@@ -175,6 +189,8 @@ namespace OpenSim.Framework | |||
175 | public string MasterAvatarFirstName = String.Empty; | 189 | public string MasterAvatarFirstName = String.Empty; |
176 | public string MasterAvatarLastName = String.Empty; | 190 | public string MasterAvatarLastName = String.Empty; |
177 | public string MasterAvatarSandboxPassword = String.Empty; | 191 | public string MasterAvatarSandboxPassword = String.Empty; |
192 | public string proxyUrl = ""; | ||
193 | public LLUUID originRegionID = LLUUID.Zero; | ||
178 | 194 | ||
179 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 195 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
180 | private EstateSettings m_estateSettings; | 196 | private EstateSettings m_estateSettings; |
@@ -227,6 +243,10 @@ namespace OpenSim.Framework | |||
227 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | 243 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; |
228 | RemotingAddress = ConvertFrom.RemotingAddress; | 244 | RemotingAddress = ConvertFrom.RemotingAddress; |
229 | RegionID = LLUUID.Zero; | 245 | RegionID = LLUUID.Zero; |
246 | proxyUrl = ConvertFrom.ProxyUrl; | ||
247 | originRegionID = ConvertFrom.OriginRegionID; | ||
248 | RegionName = ConvertFrom.RegionName; | ||
249 | ServerURI = ConvertFrom.ServerURI; | ||
230 | } | 250 | } |
231 | 251 | ||
232 | public RegionInfo(SimpleRegionInfo ConvertFrom) | 252 | public RegionInfo(SimpleRegionInfo ConvertFrom) |
@@ -239,6 +259,7 @@ namespace OpenSim.Framework | |||
239 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | 259 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; |
240 | RemotingAddress = ConvertFrom.RemotingAddress; | 260 | RemotingAddress = ConvertFrom.RemotingAddress; |
241 | RegionID = LLUUID.Zero; | 261 | RegionID = LLUUID.Zero; |
262 | ServerURI = ConvertFrom.ServerURI; | ||
242 | } | 263 | } |
243 | 264 | ||
244 | //not in use, should swap to nini though. | 265 | //not in use, should swap to nini though. |
@@ -411,4 +432,4 @@ namespace OpenSim.Framework | |||
411 | 432 | ||
412 | } | 433 | } |
413 | } | 434 | } |
414 | } \ No newline at end of file | 435 | } |
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs index 077ed8d..48ddbdf 100644 --- a/OpenSim/Framework/SerializableRegionInfo.cs +++ b/OpenSim/Framework/SerializableRegionInfo.cs | |||
@@ -51,6 +51,10 @@ namespace OpenSim.Framework | |||
51 | m_remotingPort = ConvertFrom.RemotingPort; | 51 | m_remotingPort = ConvertFrom.RemotingPort; |
52 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | 52 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; |
53 | RemotingAddress = ConvertFrom.RemotingAddress; | 53 | RemotingAddress = ConvertFrom.RemotingAddress; |
54 | m_proxyUrl = ConvertFrom.proxyUrl; | ||
55 | OriginRegionID = ConvertFrom.originRegionID; | ||
56 | RegionName = ConvertFrom.RegionName; | ||
57 | ServerURI = ConvertFrom.ServerURI; | ||
54 | } | 58 | } |
55 | 59 | ||
56 | public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 60 | public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
@@ -157,5 +161,57 @@ namespace OpenSim.Framework | |||
157 | { | 161 | { |
158 | get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); } | 162 | get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); } |
159 | } | 163 | } |
160 | } | 164 | |
161 | } \ No newline at end of file | 165 | protected string m_proxyUrl; |
166 | public string ProxyUrl | ||
167 | { | ||
168 | get | ||
169 | { | ||
170 | return m_proxyUrl; | ||
171 | } | ||
172 | set | ||
173 | { | ||
174 | m_proxyUrl = value; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | protected Guid m_originRegionID = LLUUID.Zero.UUID; | ||
179 | public LLUUID OriginRegionID | ||
180 | { | ||
181 | get | ||
182 | { | ||
183 | return new LLUUID(m_originRegionID); | ||
184 | } | ||
185 | set | ||
186 | { | ||
187 | m_originRegionID = value.UUID; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | protected string m_regionName; | ||
192 | public string RegionName | ||
193 | { | ||
194 | get | ||
195 | { | ||
196 | return m_regionName; | ||
197 | } | ||
198 | set | ||
199 | { | ||
200 | m_regionName = value; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | protected string m_serverURI; | ||
205 | public string ServerURI | ||
206 | { | ||
207 | get | ||
208 | { | ||
209 | return m_serverURI; | ||
210 | } | ||
211 | set | ||
212 | { | ||
213 | m_serverURI = value; | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | } | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 35e795b..8ba6643 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -37,6 +37,8 @@ using System.Text; | |||
37 | using libsecondlife; | 37 | using libsecondlife; |
38 | using Nini.Config; | 38 | using Nini.Config; |
39 | 39 | ||
40 | using System.Runtime.Serialization; | ||
41 | using System.Runtime.Serialization.Formatters.Binary; | ||
40 | namespace OpenSim.Framework | 42 | namespace OpenSim.Framework |
41 | { | 43 | { |
42 | public class Util | 44 | public class Util |
@@ -509,7 +511,63 @@ namespace OpenSim.Framework | |||
509 | { | 511 | { |
510 | return ""; | 512 | return ""; |
511 | } | 513 | } |
514 | } | ||
515 | |||
516 | public static void SerializeToFile(string filename, Object obj) | ||
517 | { | ||
518 | IFormatter formatter = new BinaryFormatter(); | ||
519 | Stream stream = null; | ||
520 | |||
521 | try | ||
522 | { | ||
523 | stream = new FileStream( | ||
524 | filename, FileMode.Create, | ||
525 | FileAccess.Write, FileShare.None); | ||
526 | |||
527 | formatter.Serialize(stream, obj); | ||
528 | } | ||
529 | catch (Exception e) | ||
530 | { | ||
531 | System.Console.WriteLine(e.Message); | ||
532 | System.Console.WriteLine(e.StackTrace); | ||
533 | } | ||
534 | finally | ||
535 | { | ||
536 | if (stream != null) | ||
537 | { | ||
538 | stream.Close(); | ||
539 | } | ||
540 | } | ||
541 | } | ||
542 | |||
543 | public static Object DeserializeFromFile(string filename) | ||
544 | { | ||
545 | IFormatter formatter = new BinaryFormatter(); | ||
546 | Stream stream = null; | ||
547 | Object ret = null; | ||
548 | |||
549 | try | ||
550 | { | ||
551 | stream = new FileStream( | ||
552 | filename, FileMode.Open, | ||
553 | FileAccess.Read, FileShare.None); | ||
554 | |||
555 | ret = formatter.Deserialize(stream); | ||
556 | } | ||
557 | catch (Exception e) | ||
558 | { | ||
559 | System.Console.WriteLine(e.Message); | ||
560 | System.Console.WriteLine(e.StackTrace); | ||
561 | } | ||
562 | finally | ||
563 | { | ||
564 | if (stream != null) | ||
565 | { | ||
566 | stream.Close(); | ||
567 | } | ||
568 | } | ||
512 | 569 | ||
570 | return ret; | ||
513 | } | 571 | } |
514 | } | 572 | } |
515 | } | 573 | } |
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index e32f551..2e6a892 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Data; | 38 | using OpenSim.Framework.Data; |
39 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
40 | using OpenSim.Framework.Data.MySQL; | ||
40 | 41 | ||
41 | namespace OpenSim.Grid.GridServer | 42 | namespace OpenSim.Grid.GridServer |
42 | { | 43 | { |
@@ -301,16 +302,20 @@ namespace OpenSim.Grid.GridServer | |||
301 | catch (KeyNotFoundException) { } | 302 | catch (KeyNotFoundException) { } |
302 | 303 | ||
303 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); | 304 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); |
304 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | 305 | TheSim.serverURI = (string)requestData["server_uri"]; |
306 | Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + | ||
307 | TheSim.serverURI); | ||
305 | 308 | ||
306 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; | 309 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; |
307 | 310 | ||
308 | TheSim.regionName = (string)requestData["sim_name"]; | 311 | TheSim.regionName = (string)requestData["sim_name"]; |
309 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); | 312 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); |
313 | TheSim.originUUID = new LLUUID((string) requestData["originUUID"]); | ||
310 | 314 | ||
311 | //make sure there is not an existing region at this location | 315 | //make sure there is not an existing region at this location |
312 | OldSim = getRegion(TheSim.regionHandle); | 316 | OldSim = getRegion(TheSim.regionHandle); |
313 | if (OldSim == null || OldSim.UUID == TheSim.UUID) | 317 | //if (OldSim == null || OldSim.UUID == TheSim.UUID) |
318 | if (OldSim == null || OldSim.UUID == TheSim.UUID || TheSim.UUID != TheSim.originUUID) | ||
314 | { | 319 | { |
315 | bool brandNew = ( OldSim == null && TheSim.regionRecvKey == config.SimSendKey && | 320 | bool brandNew = ( OldSim == null && TheSim.regionRecvKey == config.SimSendKey && |
316 | TheSim.regionSendKey == config.SimRecvKey); | 321 | TheSim.regionSendKey == config.SimRecvKey); |
@@ -502,6 +507,69 @@ namespace OpenSim.Grid.GridServer | |||
502 | 507 | ||
503 | /// <summary> | 508 | /// <summary> |
504 | /// Returns an XML RPC response to a simulator profile request | 509 | /// Returns an XML RPC response to a simulator profile request |
510 | /// Performed after moving a region. | ||
511 | /// </summary> | ||
512 | /// <param name="request"></param> | ||
513 | /// <returns></returns> | ||
514 | /// <param name="request">The XMLRPC Request</param> | ||
515 | /// <returns>Processing parameters</returns> | ||
516 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request) | ||
517 | { | ||
518 | XmlRpcResponse response = new XmlRpcResponse(); | ||
519 | Hashtable responseData = new Hashtable(); | ||
520 | response.Value = responseData; | ||
521 | |||
522 | //RegionProfileData TheSim = null; | ||
523 | string uuid = String.Empty;; | ||
524 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
525 | string myword; | ||
526 | if (requestData.ContainsKey("UUID")) { | ||
527 | //TheSim = getRegion(new LLUUID((string) requestData["UUID"])); | ||
528 | uuid = requestData["UUID"].ToString(); | ||
529 | Console.WriteLine("deleting region " + uuid); | ||
530 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); | ||
531 | } | ||
532 | else { | ||
533 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; | ||
534 | return response; | ||
535 | } | ||
536 | |||
537 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) { | ||
538 | //OpenSim.Framework.Data.MySQL.MySQLGridData dbengine = new OpenSim.Framework.Data.MySQL.MySQLGridData(); | ||
539 | try { | ||
540 | OpenSim.Framework.Data.MySQL.MySQLGridData mysqldata = (OpenSim.Framework.Data.MySQL.MySQLGridData)(kvp.Value); | ||
541 | //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); | ||
542 | DataResponse insertResponse = mysqldata.DeleteProfile(uuid); | ||
543 | switch (insertResponse) { | ||
544 | case DataResponse.RESPONSE_OK: | ||
545 | //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); | ||
546 | responseData["status"] = "Deleting region successful: " + uuid; | ||
547 | break; | ||
548 | case DataResponse.RESPONSE_ERROR: | ||
549 | //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid); | ||
550 | responseData["status"] = "Deleting region failed (Error): " + uuid; | ||
551 | break; | ||
552 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | ||
553 | //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid); | ||
554 | responseData["status"] = "Deleting region (Invalid Credentials): " + uuid; | ||
555 | break; | ||
556 | case DataResponse.RESPONSE_AUTHREQUIRED: | ||
557 | //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid); | ||
558 | responseData["status"] = "Deleting region (Authentication Required): " + uuid; | ||
559 | break; | ||
560 | } | ||
561 | } | ||
562 | catch (Exception e) { | ||
563 | m_log.Error("storage Unable to delete region " + uuid + " via MySQL"); | ||
564 | //MainLog.Instance.Warn("storage", e.ToString()); | ||
565 | } | ||
566 | } | ||
567 | |||
568 | return response; | ||
569 | } | ||
570 | |||
571 | /// <summary> | ||
572 | /// Returns an XML RPC response to a simulator profile request | ||
505 | /// </summary> | 573 | /// </summary> |
506 | /// <param name="request"></param> | 574 | /// <param name="request"></param> |
507 | /// <returns></returns> | 575 | /// <returns></returns> |
@@ -533,6 +601,7 @@ namespace OpenSim.Grid.GridServer | |||
533 | (string) requestData["region_handle"]); | 601 | (string) requestData["region_handle"]); |
534 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); | 602 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); |
535 | responseData["sim_port"] = simData.serverPort.ToString(); | 603 | responseData["sim_port"] = simData.serverPort.ToString(); |
604 | responseData["server_uri"] = simData.serverURI; | ||
536 | responseData["http_port"] = simData.httpPort.ToString(); | 605 | responseData["http_port"] = simData.httpPort.ToString(); |
537 | responseData["remoting_port"] = simData.remotingPort.ToString(); | 606 | responseData["remoting_port"] = simData.remotingPort.ToString(); |
538 | responseData["region_locx"] = simData.regionLocX.ToString(); | 607 | responseData["region_locx"] = simData.regionLocX.ToString(); |
@@ -798,8 +867,7 @@ namespace OpenSim.Grid.GridServer | |||
798 | } | 867 | } |
799 | } | 868 | } |
800 | 869 | ||
801 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | 870 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; |
802 | |||
803 | bool requirePublic = false; | 871 | bool requirePublic = false; |
804 | bool requireValid = true; | 872 | bool requireValid = true; |
805 | 873 | ||
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index ff4a888..ff4cfa2 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -113,6 +113,7 @@ namespace OpenSim.Grid.GridServer | |||
113 | 113 | ||
114 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | 114 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); |
115 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); | 115 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); |
116 | httpServer.AddXmlRPCHandler("simulator_after_region_moved", m_gridManager.XmlRpcDeleteRegionMethod); | ||
116 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | 117 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); |
117 | 118 | ||
118 | // Message Server ---> Grid Server | 119 | // Message Server ---> Grid Server |
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 0b832f4..e03ac3a 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -99,8 +99,8 @@ namespace OpenSim.Grid.UserServer | |||
99 | //CFK: the next one for X & Y and comment this one. | 99 | //CFK: the next one for X & Y and comment this one. |
100 | //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + | 100 | //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + |
101 | //CFK: "; Region Y: " + SimInfo.regionLocY); | 101 | //CFK: "; Region Y: " + SimInfo.regionLocY); |
102 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); | 102 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); |
103 | response.SimPort = (uint) SimInfo.serverPort; | 103 | response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); |
104 | response.RegionX = SimInfo.regionLocX; | 104 | response.RegionX = SimInfo.regionLocX; |
105 | response.RegionY = SimInfo.regionLocY; | 105 | response.RegionY = SimInfo.regionLocY; |
106 | 106 | ||
@@ -190,8 +190,8 @@ namespace OpenSim.Grid.UserServer | |||
190 | m_log.Info("[LOGIN]: " + | 190 | m_log.Info("[LOGIN]: " + |
191 | "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + | 191 | "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + |
192 | SimInfo.regionLocY); | 192 | SimInfo.regionLocY); |
193 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); | 193 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); |
194 | response.SimPort = (uint) SimInfo.serverPort; | 194 | response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); |
195 | response.RegionX = SimInfo.regionLocX; | 195 | response.RegionX = SimInfo.regionLocX; |
196 | response.RegionY = SimInfo.regionLocY; | 196 | response.RegionY = SimInfo.regionLocY; |
197 | 197 | ||
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 | } |