diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Client/MXP/MXPModule.cs | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs deleted file mode 100644 index 0b442cc..0000000 --- a/OpenSim/Client/MXP/MXPModule.cs +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Timers; | ||
33 | using log4net; | ||
34 | using MXP; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Client.MXP.PacketHandler; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | |||
41 | namespace OpenSim.Client.MXP | ||
42 | { | ||
43 | |||
44 | /** | ||
45 | * MXP Client Module which adds MXP support to client / region communication. | ||
46 | */ | ||
47 | public class MXPModule : IRegionModule | ||
48 | { | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private MXPPacketServer m_server; | ||
52 | |||
53 | private IConfigSource m_config; | ||
54 | private int m_port = 1253; | ||
55 | private Timer m_ticker; | ||
56 | |||
57 | private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | ||
58 | private bool m_shutdown; | ||
59 | |||
60 | public void Initialise(Scene scene, IConfigSource source) | ||
61 | { | ||
62 | if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID)) | ||
63 | m_scenes.Add(scene.RegionInfo.RegionID, scene); | ||
64 | |||
65 | m_config = source; | ||
66 | } | ||
67 | |||
68 | public void PostInitialise() | ||
69 | { | ||
70 | if (m_config.Configs["MXP"] != null) | ||
71 | { | ||
72 | IConfig con = m_config.Configs["MXP"]; | ||
73 | |||
74 | if (!con.GetBoolean("Enabled", false)) | ||
75 | return; | ||
76 | |||
77 | m_port = con.GetInt("Port", m_port); | ||
78 | |||
79 | m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true)); | ||
80 | |||
81 | m_ticker = new Timer(100); | ||
82 | m_ticker.AutoReset = false; | ||
83 | m_ticker.Elapsed += ticker_Elapsed; | ||
84 | |||
85 | lock (m_ticker) | ||
86 | m_ticker.Start(); | ||
87 | |||
88 | m_log.Info("[MXP ClientStack] MXP Enabled and Listening"); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | void ticker_Elapsed(object sender, ElapsedEventArgs e) | ||
93 | { | ||
94 | try | ||
95 | { | ||
96 | m_server.Process(); | ||
97 | } | ||
98 | catch (Exception ex) | ||
99 | { | ||
100 | m_log.Error("[MXP ClientStack]: Unhandled exception in process loop: " + ex.ToString() + " :" + ex.StackTrace.ToString()); | ||
101 | } | ||
102 | |||
103 | if (!m_shutdown) | ||
104 | { | ||
105 | lock (m_ticker) | ||
106 | m_ticker.Start(); | ||
107 | } | ||
108 | } | ||
109 | |||
110 | public void Close() | ||
111 | { | ||
112 | m_shutdown = true; | ||
113 | if (m_ticker != null) | ||
114 | { | ||
115 | lock (m_ticker) | ||
116 | m_ticker.Stop(); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | public string Name | ||
121 | { | ||
122 | get { return "MXP ClientStack Module"; } | ||
123 | } | ||
124 | |||
125 | public bool IsSharedModule | ||
126 | { | ||
127 | get { return true; } | ||
128 | } | ||
129 | |||
130 | } | ||
131 | } | ||