aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/MXP/MXPModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Client/MXP/MXPModule.cs87
1 files changed, 87 insertions, 0 deletions
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs
new file mode 100644
index 0000000..345e4fb
--- /dev/null
+++ b/OpenSim/Client/MXP/MXPModule.cs
@@ -0,0 +1,87 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Timers;
5using MXP;
6using Nini.Config;
7using OpenMetaverse;
8using OpenSim.Client.MXP.PacketHandler;
9using OpenSim.Region.Framework.Interfaces;
10using OpenSim.Region.Framework.Scenes;
11
12namespace OpenSim.Client.MXP
13{
14 public class MXPModule : IRegionModule
15 {
16 private int mxp_Port = 1253;
17 private double mxp_BubbleRadius = 181.01933598375616624661615669884; // Radius of a sphere big enough to encapsulate a 256x256 square
18
19 private readonly Timer ticker = new Timer(100);
20
21 private int ticks;
22 private bool shutdown = false;
23
24 private IConfigSource config;
25
26 private readonly Dictionary<UUID,Scene> m_scenes = new Dictionary<UUID, Scene>();
27
28 private MXPPacketServer server;
29
30
31 public void Initialise(Scene scene, IConfigSource source)
32 {
33 m_scenes.Add(scene.RegionInfo.RegionID, scene);
34 config = source;
35 }
36
37 public void PostInitialise()
38 {
39 if (config.Configs["MXP"] != null)
40 {
41 IConfig con = config.Configs["MXP"];
42
43 if(!con.GetBoolean("Enabled",false))
44 return;
45
46 mxp_Port = con.GetInt("Port", mxp_Port);
47
48
49 server = new MXPPacketServer("http://null", mxp_Port, m_scenes);
50
51 ticker.AutoReset = false;
52 ticker.Elapsed += ticker_Elapsed;
53
54 ticker.Start();
55 }
56 }
57
58 void ticker_Elapsed(object sender, ElapsedEventArgs e)
59 {
60 server.Process();
61
62 if (!shutdown)
63 ticker.Start();
64
65 if(++ticks % 100 == 0)
66 {
67 server.PrintDebugInformation();
68 }
69 }
70
71 public void Close()
72 {
73 shutdown = true;
74 ticker.Stop();
75 }
76
77 public string Name
78 {
79 get { return "MXP ClientStack Module"; }
80 }
81
82 public bool IsSharedModule
83 {
84 get { return true; }
85 }
86 }
87}