aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-04-30 21:43:47 +0000
committerAdam Frisby2008-04-30 21:43:47 +0000
commitbe20f41637b6c06ce3ab16bc25851b6e43468e12 (patch)
treec41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
parent* Sometimes you know, you do something really stupid. (diff)
downloadopensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip
opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz
opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2
opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs137
1 files changed, 71 insertions, 66 deletions
diff --git a/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs b/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
index 1a77ac8..8307e50 100644
--- a/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
+++ b/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
@@ -35,61 +35,14 @@ namespace OpenSim.Region.Environment.Modules.Communications.Interregion
35 private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>(); 35 private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
36 private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>(); 36 private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
37 private IConfigSource m_config; 37 private IConfigSource m_config;
38 private RemotingObject m_myRemote; 38 private bool m_enabled = false;
39 39
40 private Object m_lockObject = new object(); 40 private Object m_lockObject = new object();
41 private RemotingObject m_myRemote;
41 private TcpChannel m_tcpChannel; 42 private TcpChannel m_tcpChannel;
42 private int m_tcpPort = 10101; 43 private int m_tcpPort = 10101;
43 private bool m_enabled = false;
44
45 #region IRegionModule Members
46
47 //TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
48 public void Initialise(Scene scene, IConfigSource source)
49 {
50 if (m_enabled)
51 {
52 m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
53 (int) scene.RegionInfo.RegionLocY));
54 m_config = source;
55
56 scene.RegisterModuleInterface<IInterregionModule>(this);
57 }
58 }
59
60 //TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
61 public void PostInitialise()
62 {
63 if (m_enabled)
64 {
65 try
66 {
67 m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
68 }
69 catch
70 {
71 }
72
73 internal_CreateRemotingObjects();
74 }
75 }
76
77 public void Close()
78 {
79 ChannelServices.UnregisterChannel(m_tcpChannel);
80 }
81
82 public string Name
83 {
84 get { return "InterregionModule"; }
85 }
86
87 public bool IsSharedModule
88 {
89 get { return true; }
90 }
91 44
92 #endregion 45 #region IInterregionModule Members
93 46
94 public void internal_CreateRemotingObjects() 47 public void internal_CreateRemotingObjects()
95 { 48 {
@@ -106,22 +59,6 @@ namespace OpenSim.Region.Environment.Modules.Communications.Interregion
106 } 59 }
107 } 60 }
108 61
109 public void RegisterRemoteRegion(string uri)
110 {
111 RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
112 }
113
114 private void RegisterRemotingInterface(RemotingObject remote)
115 {
116 Location[] locs = remote.GetLocations();
117 string[] interfaces = remote.GetInterfaces();
118 foreach (Location loc in locs)
119 {
120 m_neighbourInterfaces[loc] = interfaces;
121 m_neighbourRemote[loc] = remote;
122 }
123 }
124
125 public void RegisterMethod<T>(T e) 62 public void RegisterMethod<T>(T e)
126 { 63 {
127 m_interfaces[typeof (T)] = e; 64 m_interfaces[typeof (T)] = e;
@@ -171,5 +108,73 @@ namespace OpenSim.Region.Environment.Modules.Communications.Interregion
171 { 108 {
172 return new Location(0, 0); 109 return new Location(0, 0);
173 } 110 }
111
112 #endregion
113
114 //TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
115
116 #region IRegionModule Members
117
118 public void Initialise(Scene scene, IConfigSource source)
119 {
120 if (m_enabled)
121 {
122 m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
123 (int) scene.RegionInfo.RegionLocY));
124 m_config = source;
125
126 scene.RegisterModuleInterface<IInterregionModule>(this);
127 }
128 }
129
130 //TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
131 public void PostInitialise()
132 {
133 if (m_enabled)
134 {
135 try
136 {
137 m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
138 }
139 catch
140 {
141 }
142
143 internal_CreateRemotingObjects();
144 }
145 }
146
147 public void Close()
148 {
149 ChannelServices.UnregisterChannel(m_tcpChannel);
150 }
151
152 public string Name
153 {
154 get { return "InterregionModule"; }
155 }
156
157 public bool IsSharedModule
158 {
159 get { return true; }
160 }
161
162 #endregion
163
164 public void RegisterRemoteRegion(string uri)
165 {
166 RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
167 }
168
169 private void RegisterRemotingInterface(RemotingObject remote)
170 {
171 Location[] locs = remote.GetLocations();
172 string[] interfaces = remote.GetInterfaces();
173 foreach (Location loc in locs)
174 {
175 m_neighbourInterfaces[loc] = interfaces;
176 m_neighbourRemote[loc] = remote;
177 }
178 }
174 } 179 }
175} \ No newline at end of file 180} \ No newline at end of file