diff options
author | Adam Frisby | 2008-05-01 16:41:01 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 16:41:01 +0000 |
commit | fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8 (patch) | |
tree | 90a4799fa43e3761ffbe669d1d87837933d8db53 /ThirdParty | |
parent | * Deletes my EventReader ScriptRewriter. It isn't required to rewrite the sc... (diff) | |
download | opensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.zip opensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.gz opensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.bz2 opensim-SC-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.xz |
* Cleaning code still.
Diffstat (limited to 'ThirdParty')
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | 58 | ||||
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/TcpClient.cs | 24 | ||||
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/TcpServer.cs | 14 | ||||
-rw-r--r-- | ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs | 8 |
4 files changed, 49 insertions, 55 deletions
diff --git a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs index 6d593c9..af979a6 100644 --- a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs +++ b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | |||
@@ -52,12 +52,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
52 | public class LoadBalancerPlugin : IApplicationPlugin | 52 | public class LoadBalancerPlugin : IApplicationPlugin |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | private readonly object padlock = new object(); | ||
55 | 56 | ||
56 | private BaseHttpServer commandServer; | 57 | private BaseHttpServer commandServer; |
57 | private bool[] isLocalNeighbour; | 58 | private bool[] isLocalNeighbour; |
58 | private bool isSplit = false; | 59 | private bool isSplit; |
59 | private TcpServer mTcpServer; | 60 | private TcpServer mTcpServer; |
60 | private object padlock = new object(); | ||
61 | 61 | ||
62 | private int proxyOffset; | 62 | private int proxyOffset; |
63 | private string proxyURL; | 63 | private string proxyURL; |
@@ -80,8 +80,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
80 | if (proxyURL.Length == 0) return; | 80 | if (proxyURL.Length == 0) return; |
81 | 81 | ||
82 | StartTcpServer(); | 82 | StartTcpServer(); |
83 | ClientView.SynchronizeClient = new ClientView.SynchronizeClientHandler(SynchronizePackets); | 83 | ClientView.SynchronizeClient = SynchronizePackets; |
84 | AsynchronousSocketListener.PacketHandler = new AsynchronousSocketListener.PacketRecieveHandler(SynchronizePacketRecieve); | 84 | AsynchronousSocketListener.PacketHandler = SynchronizePacketRecieve; |
85 | 85 | ||
86 | sceneManager = openSim.SceneManager; | 86 | sceneManager = openSim.SceneManager; |
87 | udpServers = openSim.UdpServers; | 87 | udpServers = openSim.UdpServers; |
@@ -146,7 +146,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
146 | { | 146 | { |
147 | ClientView client = (ClientView) pre.ControllingClient; | 147 | ClientView client = (ClientView) pre.ControllingClient; |
148 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { | 148 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { |
149 | if (client.PacketProcessingEnabled == true) | 149 | if (client.PacketProcessingEnabled) |
150 | { | 150 | { |
151 | get_scene_presence_filter++; | 151 | get_scene_presence_filter++; |
152 | } | 152 | } |
@@ -159,7 +159,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
159 | { | 159 | { |
160 | ClientView client = (ClientView) pre.ControllingClient; | 160 | ClientView client = (ClientView) pre.ControllingClient; |
161 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { | 161 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { |
162 | if (client.PacketProcessingEnabled == true) | 162 | if (client.PacketProcessingEnabled) |
163 | { | 163 | { |
164 | get_avatar_filter++; | 164 | get_avatar_filter++; |
165 | avatar_names += pre.Firstname + " " + pre.Lastname + "; "; | 165 | avatar_names += pre.Firstname + " " + pre.Lastname + "; "; |
@@ -178,7 +178,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
178 | } | 178 | } |
179 | catch (Exception e) | 179 | catch (Exception e) |
180 | { | 180 | { |
181 | m_log.Error("[BALANCER] " + e.ToString()); | 181 | m_log.Error("[BALANCER] " + e); |
182 | m_log.Error("[BALANCER] " + e.StackTrace); | 182 | m_log.Error("[BALANCER] " + e.StackTrace); |
183 | } | 183 | } |
184 | return response; | 184 | return response; |
@@ -199,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
199 | } | 199 | } |
200 | catch (Exception e) | 200 | catch (Exception e) |
201 | { | 201 | { |
202 | m_log.Error("[BALANCER] " + e.ToString()); | 202 | m_log.Error("[BALANCER] " + e); |
203 | m_log.Error("[BALANCER] " + e.StackTrace); | 203 | m_log.Error("[BALANCER] " + e.StackTrace); |
204 | } | 204 | } |
205 | 205 | ||
@@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
223 | } | 223 | } |
224 | catch (Exception e) | 224 | catch (Exception e) |
225 | { | 225 | { |
226 | m_log.Error("[BALANCER] " + e.ToString()); | 226 | m_log.Error("[BALANCER] " + e); |
227 | m_log.Error("[BALANCER] " + e.StackTrace); | 227 | m_log.Error("[BALANCER] " + e.StackTrace); |
228 | } | 228 | } |
229 | 229 | ||
@@ -247,7 +247,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
247 | } | 247 | } |
248 | catch (Exception e) | 248 | catch (Exception e) |
249 | { | 249 | { |
250 | m_log.Error("[BALANCER] " + e.ToString()); | 250 | m_log.Error("[BALANCER] " + e); |
251 | m_log.Error("[BALANCER] " + e.StackTrace); | 251 | m_log.Error("[BALANCER] " + e.StackTrace); |
252 | throw e; | 252 | throw e; |
253 | } | 253 | } |
@@ -264,14 +264,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
264 | int src_port = (int) request.Params[0]; | 264 | int src_port = (int) request.Params[0]; |
265 | 265 | ||
266 | // backgroud | 266 | // backgroud |
267 | WaitCallback callback = new WaitCallback(TerminateRegion); | 267 | WaitCallback callback = TerminateRegion; |
268 | ThreadPool.QueueUserWorkItem(callback, src_port); | 268 | ThreadPool.QueueUserWorkItem(callback, src_port); |
269 | 269 | ||
270 | m_log.Info("[BALANCER] " + "Exiting TerminateRegion()"); | 270 | m_log.Info("[BALANCER] " + "Exiting TerminateRegion()"); |
271 | } | 271 | } |
272 | catch (Exception e) | 272 | catch (Exception e) |
273 | { | 273 | { |
274 | m_log.Error("[BALANCER] " + e.ToString()); | 274 | m_log.Error("[BALANCER] " + e); |
275 | m_log.Error("[BALANCER] " + e.StackTrace); | 275 | m_log.Error("[BALANCER] " + e.StackTrace); |
276 | } | 276 | } |
277 | 277 | ||
@@ -330,8 +330,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
330 | dst_region = DeserializeRegion(dst_port, false, serializeDir); | 330 | dst_region = DeserializeRegion(dst_port, false, serializeDir); |
331 | 331 | ||
332 | // Decide who is in charge for each section | 332 | // Decide who is in charge for each section |
333 | int[] port = new int[] {src_port, dst_port}; | 333 | int[] port = new[] {src_port, dst_port}; |
334 | string[] url = new string[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port}; | 334 | string[] url = new[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port}; |
335 | for (int i = 0; i < 2; i++) Util.XmlRpcCommand(url[i], "SplitRegion", i, 2, port[0], port[1], url[0], url[1]); | 335 | for (int i = 0; i < 2; i++) Util.XmlRpcCommand(url[i], "SplitRegion", i, 2, port[0], port[1], url[0], url[1]); |
336 | 336 | ||
337 | // Enable the proxy | 337 | // Enable the proxy |
@@ -424,7 +424,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
424 | // serialization of region data | 424 | // serialization of region data |
425 | SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region); | 425 | SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region); |
426 | 426 | ||
427 | filename = export_dir + "RegionInfo_" + src_region.RegionID.ToString() + ".bin"; | 427 | filename = export_dir + "RegionInfo_" + src_region.RegionID + ".bin"; |
428 | Util.SerializeToFile(filename, dst_region); | 428 | Util.SerializeToFile(filename, dst_region); |
429 | 429 | ||
430 | // backup current scene's entities | 430 | // backup current scene's entities |
@@ -451,7 +451,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
451 | { | 451 | { |
452 | ClientInfo info = controller.GetClientInfo(); | 452 | ClientInfo info = controller.GetClientInfo(); |
453 | 453 | ||
454 | filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode.ToString() + ".bin"; | 454 | filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode + ".bin"; |
455 | 455 | ||
456 | Util.SerializeToFile(filename, info); | 456 | Util.SerializeToFile(filename, info); |
457 | 457 | ||
@@ -469,13 +469,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
469 | 469 | ||
470 | private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir) | 470 | private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir) |
471 | { | 471 | { |
472 | string[] files = null; | ||
473 | RegionInfo dst_region = null; | 472 | RegionInfo dst_region = null; |
474 | 473 | ||
475 | try | 474 | try |
476 | { | 475 | { |
477 | // deserialization of region data | 476 | // deserialization of region data |
478 | files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); | 477 | string[] files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); |
479 | 478 | ||
480 | foreach (string filename in files) | 479 | foreach (string filename in files) |
481 | { | 480 | { |
@@ -503,7 +502,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
503 | } | 502 | } |
504 | catch (Exception e) | 503 | catch (Exception e) |
505 | { | 504 | { |
506 | m_log.Error("[BALANCER] " + e.ToString()); | 505 | m_log.Error("[BALANCER] " + e); |
507 | m_log.Error("[BALANCER] " + e.StackTrace); | 506 | m_log.Error("[BALANCER] " + e.StackTrace); |
508 | throw e; | 507 | throw e; |
509 | } | 508 | } |
@@ -593,7 +592,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
593 | 592 | ||
594 | // change RegionInfo (memory only) | 593 | // change RegionInfo (memory only) |
595 | dst_region.InternalEndPoint.Port = dst_port; | 594 | dst_region.InternalEndPoint.Port = dst_port; |
596 | dst_region.ExternalHostName = proxyURL.Split(new char[] {'/', ':'})[3]; | 595 | dst_region.ExternalHostName = proxyURL.Split(new[] {'/', ':'})[3]; |
597 | 596 | ||
598 | // Create new region | 597 | // Create new region |
599 | simMain.CreateRegion(dst_region, false); | 598 | simMain.CreateRegion(dst_region, false); |
@@ -695,7 +694,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
695 | 694 | ||
696 | for (int i = 0; i < numRegions; i++) | 695 | for (int i = 0; i < numRegions; i++) |
697 | { | 696 | { |
698 | hostname = sceneURL[i].Split(new char[] {'/', ':'})[3]; | 697 | hostname = sceneURL[i].Split(new[] {'/', ':'})[3]; |
699 | m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); | 698 | m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); |
700 | tcpClientList[i] = new TcpClient(hostname, 10001); | 699 | tcpClientList[i] = new TcpClient(hostname, 10001); |
701 | } | 700 | } |
@@ -731,12 +730,11 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
731 | List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); | 730 | List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); |
732 | circuits.Sort(); | 731 | circuits.Sort(); |
733 | 732 | ||
734 | IClientAPI controller = null; | ||
735 | |||
736 | foreach (uint code in circuits) | 733 | foreach (uint code in circuits) |
737 | { | 734 | { |
738 | m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); | 735 | m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); |
739 | 736 | ||
737 | IClientAPI controller; | ||
740 | if (scene.ClientManager.TryGetClient(code, out controller)) | 738 | if (scene.ClientManager.TryGetClient(code, out controller)) |
741 | { | 739 | { |
742 | // Divide the presences evenly over the set of subscenes | 740 | // Divide the presences evenly over the set of subscenes |
@@ -756,7 +754,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
756 | } | 754 | } |
757 | 755 | ||
758 | scene.splitID = myID; | 756 | scene.splitID = myID; |
759 | scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes); | 757 | scene.SynchronizeScene = SynchronizeScenes; |
760 | isSplit = true; | 758 | isSplit = true; |
761 | } | 759 | } |
762 | else | 760 | else |
@@ -766,7 +764,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
766 | } | 764 | } |
767 | catch (Exception e) | 765 | catch (Exception e) |
768 | { | 766 | { |
769 | m_log.Error("[SPLITSCENE] " + e.ToString()); | 767 | m_log.Error("[SPLITSCENE] " + e); |
770 | m_log.Error("[SPLITSCENE] " + e.StackTrace); | 768 | m_log.Error("[SPLITSCENE] " + e.StackTrace); |
771 | } | 769 | } |
772 | 770 | ||
@@ -820,7 +818,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
820 | } | 818 | } |
821 | catch (Exception e) | 819 | catch (Exception e) |
822 | { | 820 | { |
823 | m_log.Error("[BALANCER] " + e.ToString()); | 821 | m_log.Error("[BALANCER] " + e); |
824 | m_log.Error("[BALANCER] " + e.StackTrace); | 822 | m_log.Error("[BALANCER] " + e.StackTrace); |
825 | throw e; | 823 | throw e; |
826 | } | 824 | } |
@@ -893,7 +891,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
893 | // Because data changes by the physics simulation when the client doesn't move, | 891 | // Because data changes by the physics simulation when the client doesn't move, |
894 | // if MovementFlag is false, It is necessary to synchronize. | 892 | // if MovementFlag is false, It is necessary to synchronize. |
895 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) | 893 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) |
896 | if (client.PacketProcessingEnabled == true) | 894 | if (client.PacketProcessingEnabled) |
897 | { | 895 | { |
898 | //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); | 896 | //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); |
899 | 897 | ||
@@ -1016,7 +1014,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1016 | return; | 1014 | return; |
1017 | } | 1015 | } |
1018 | 1016 | ||
1019 | if (((ClientView) pre.ControllingClient).PacketProcessingEnabled == true) | 1017 | if (((ClientView) pre.ControllingClient).PacketProcessingEnabled) |
1020 | { | 1018 | { |
1021 | pre.ControllingClient.OutPacket(packet, throttlePacketType); | 1019 | pre.ControllingClient.OutPacket(packet, throttlePacketType); |
1022 | } | 1020 | } |
@@ -1060,7 +1058,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1060 | } | 1058 | } |
1061 | catch (Exception e) | 1059 | catch (Exception e) |
1062 | { | 1060 | { |
1063 | m_log.Error("[SPLITSCENE] " + e.ToString()); | 1061 | m_log.Error("[SPLITSCENE] " + e); |
1064 | m_log.Error("[SPLITSCENE] " + e.StackTrace); | 1062 | m_log.Error("[SPLITSCENE] " + e.StackTrace); |
1065 | } | 1063 | } |
1066 | 1064 | ||
@@ -1072,7 +1070,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1072 | LLUUID scenePresenceID = new LLUUID(header.agent_id); | 1070 | LLUUID scenePresenceID = new LLUUID(header.agent_id); |
1073 | LLVector3 position = new LLVector3(buff, 0); | 1071 | LLVector3 position = new LLVector3(buff, 0); |
1074 | LLVector3 velocity = new LLVector3(buff, 12); | 1072 | LLVector3 velocity = new LLVector3(buff, 12); |
1075 | bool flying = ((buff[24] == (byte) 1) ? true : false); | 1073 | bool flying = ((buff[24] == 1) ? true : false); |
1076 | 1074 | ||
1077 | LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); | 1075 | LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); |
1078 | 1076 | ||
diff --git a/ThirdParty/3Di/LoadBalancer/TcpClient.cs b/ThirdParty/3Di/LoadBalancer/TcpClient.cs index af678a0..e9e019c 100644 --- a/ThirdParty/3Di/LoadBalancer/TcpClient.cs +++ b/ThirdParty/3Di/LoadBalancer/TcpClient.cs | |||
@@ -34,8 +34,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
34 | { | 34 | { |
35 | public class AsynchronousClient | 35 | public class AsynchronousClient |
36 | { | 36 | { |
37 | private static ManualResetEvent connectDone = new ManualResetEvent(false); | 37 | private static readonly ManualResetEvent connectDone = new ManualResetEvent(false); |
38 | private static ManualResetEvent sendDone = new ManualResetEvent(false); | 38 | private static readonly ManualResetEvent sendDone = new ManualResetEvent(false); |
39 | 39 | ||
40 | public static Socket StartClient(string hostname, int port) | 40 | public static Socket StartClient(string hostname, int port) |
41 | { | 41 | { |
@@ -46,7 +46,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
46 | IPEndPoint remoteEP = new IPEndPoint(ipAddress, port); | 46 | IPEndPoint remoteEP = new IPEndPoint(ipAddress, port); |
47 | 47 | ||
48 | Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); | 48 | Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
49 | client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client); | 49 | client.BeginConnect(remoteEP, ConnectCallback, client); |
50 | connectDone.WaitOne(); | 50 | connectDone.WaitOne(); |
51 | /* | 51 | /* |
52 | Send(client,"This is a test<EOF>"); | 52 | Send(client,"This is a test<EOF>"); |
@@ -71,7 +71,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
71 | { | 71 | { |
72 | Socket client = (Socket) ar.AsyncState; | 72 | Socket client = (Socket) ar.AsyncState; |
73 | client.EndConnect(ar); | 73 | client.EndConnect(ar); |
74 | Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString()); | 74 | Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint); |
75 | connectDone.Set(); | 75 | connectDone.Set(); |
76 | } | 76 | } |
77 | catch (Exception e) | 77 | catch (Exception e) |
@@ -138,8 +138,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
138 | 138 | ||
139 | public class InternalPacketHeader | 139 | public class InternalPacketHeader |
140 | { | 140 | { |
141 | private readonly byte[] buffer = new byte[32]; | ||
141 | public Guid agent_id; | 142 | public Guid agent_id; |
142 | private byte[] buffer = new byte[32]; | ||
143 | public int numbytes; | 143 | public int numbytes; |
144 | public int region_port; | 144 | public int region_port; |
145 | public int throttlePacketType; | 145 | public int throttlePacketType; |
@@ -150,16 +150,16 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
150 | int i = 0; // offset | 150 | int i = 0; // offset |
151 | try | 151 | try |
152 | { | 152 | { |
153 | type = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); | 153 | type = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); |
154 | throttlePacketType = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); | 154 | throttlePacketType = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); |
155 | numbytes = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); | 155 | numbytes = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); |
156 | agent_id = new Guid( | 156 | agent_id = new Guid( |
157 | bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24, | 157 | bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24, |
158 | (short) (bytes[i++] | (bytes[i++] << 8)), | 158 | (short) (bytes[i++] | (bytes[i++] << 8)), |
159 | (short) (bytes[i++] | (bytes[i++] << 8)), | 159 | (short) (bytes[i++] | (bytes[i++] << 8)), |
160 | bytes[i++], bytes[i++], bytes[i++], bytes[i++], | 160 | bytes[i++], bytes[i++], bytes[i++], bytes[i++], |
161 | bytes[i++], bytes[i++], bytes[i++], bytes[i++]); | 161 | bytes[i++], bytes[i++], bytes[i++], bytes[i++]); |
162 | region_port = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); | 162 | region_port = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); |
163 | } | 163 | } |
164 | catch (Exception) | 164 | catch (Exception) |
165 | { | 165 | { |
@@ -201,10 +201,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
201 | public class TcpClient | 201 | public class TcpClient |
202 | { | 202 | { |
203 | public static int internalPacketHeaderSize = 4 * 4 + 16 * 1; | 203 | public static int internalPacketHeaderSize = 4 * 4 + 16 * 1; |
204 | private Socket mConnection; | ||
205 | 204 | ||
206 | private string mHostname; | 205 | private readonly string mHostname; |
207 | private int mPort; | 206 | private readonly int mPort; |
207 | private Socket mConnection; | ||
208 | 208 | ||
209 | public TcpClient(string hostname, int port) | 209 | public TcpClient(string hostname, int port) |
210 | { | 210 | { |
diff --git a/ThirdParty/3Di/LoadBalancer/TcpServer.cs b/ThirdParty/3Di/LoadBalancer/TcpServer.cs index 9722a1b..cd94b95 100644 --- a/ThirdParty/3Di/LoadBalancer/TcpServer.cs +++ b/ThirdParty/3Di/LoadBalancer/TcpServer.cs | |||
@@ -37,15 +37,15 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
37 | { | 37 | { |
38 | public const int BufferSize = 2048; | 38 | public const int BufferSize = 2048; |
39 | public byte[] buffer = new byte[BufferSize]; | 39 | public byte[] buffer = new byte[BufferSize]; |
40 | public InternalPacketHeader header = null; | 40 | public InternalPacketHeader header; |
41 | public MemoryStream ms_ptr = new MemoryStream(); | 41 | public MemoryStream ms_ptr = new MemoryStream(); |
42 | public Socket workSocket = null; | 42 | public Socket workSocket; |
43 | } | 43 | } |
44 | 44 | ||
45 | public class AsynchronousSocketListener | 45 | public class AsynchronousSocketListener |
46 | { | 46 | { |
47 | public static ManualResetEvent allDone = new ManualResetEvent(false); | 47 | public static ManualResetEvent allDone = new ManualResetEvent(false); |
48 | public static string data = null; | 48 | public static string data; |
49 | 49 | ||
50 | #region KIRYU | 50 | #region KIRYU |
51 | 51 | ||
@@ -55,14 +55,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
55 | 55 | ||
56 | #endregion | 56 | #endregion |
57 | 57 | ||
58 | public static PacketRecieveHandler PacketHandler = null; | 58 | public static PacketRecieveHandler PacketHandler; |
59 | 59 | ||
60 | #endregion | 60 | #endregion |
61 | 61 | ||
62 | public AsynchronousSocketListener() | ||
63 | { | ||
64 | } | ||
65 | |||
66 | public static void StartListening(int port) | 62 | public static void StartListening(int port) |
67 | { | 63 | { |
68 | IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); | 64 | IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); |
@@ -199,7 +195,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
199 | 195 | ||
200 | public class TcpServer | 196 | public class TcpServer |
201 | { | 197 | { |
202 | private int mPort = 11000; | 198 | private readonly int mPort = 11000; |
203 | 199 | ||
204 | public TcpServer() | 200 | public TcpServer() |
205 | { | 201 | { |
diff --git a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs index eaafe6c..2c86fd4 100644 --- a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs +++ b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy | |||
75 | string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", ""); | 75 | string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", ""); |
76 | if (proxyURL.Length == 0) return; | 76 | if (proxyURL.Length == 0) return; |
77 | 77 | ||
78 | uint port = (uint) Int32.Parse(proxyURL.Split(new char[] {':'})[2]); | 78 | uint port = (uint) Int32.Parse(proxyURL.Split(new[] {':'})[2]); |
79 | command_server = new BaseHttpServer(port); | 79 | command_server = new BaseHttpServer(port); |
80 | command_server.Start(); | 80 | command_server.Start(); |
81 | command_server.AddXmlRPCHandler("AddPort", AddPort); | 81 | command_server.AddXmlRPCHandler("AddPort", AddPort); |
@@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy | |||
223 | { | 223 | { |
224 | m_log = log; | 224 | m_log = log; |
225 | running = false; | 225 | running = false; |
226 | receivedData = new AsyncCallback(OnReceivedData); | 226 | receivedData = OnReceivedData; |
227 | } | 227 | } |
228 | 228 | ||
229 | public void BlockClientMessages(string regionUrl, int regionPort) | 229 | public void BlockClientMessages(string regionUrl, int regionPort) |
@@ -452,7 +452,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy | |||
452 | 452 | ||
453 | protected class ProxyMap | 453 | protected class ProxyMap |
454 | { | 454 | { |
455 | private Dictionary<EndPoint, RegionData> map; | 455 | private readonly Dictionary<EndPoint, RegionData> map; |
456 | 456 | ||
457 | public ProxyMap() | 457 | public ProxyMap() |
458 | { | 458 | { |
@@ -494,7 +494,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy | |||
494 | 494 | ||
495 | public class RegionData | 495 | public class RegionData |
496 | { | 496 | { |
497 | public bool isBlocked = false; | 497 | public bool isBlocked; |
498 | public List<EndPoint> regions = new List<EndPoint>(); | 498 | public List<EndPoint> regions = new List<EndPoint>(); |
499 | public Queue storedMessages = new Queue(); | 499 | public Queue storedMessages = new Queue(); |
500 | } | 500 | } |