diff options
Diffstat (limited to '')
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | 60 | ||||
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/TcpClient.cs | 24 | ||||
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/TcpServer.cs | 14 |
3 files changed, 52 insertions, 46 deletions
diff --git a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs index af979a6..dda8be6 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(); | ||
56 | 55 | ||
57 | private BaseHttpServer commandServer; | 56 | private BaseHttpServer commandServer; |
58 | private bool[] isLocalNeighbour; | 57 | private bool[] isLocalNeighbour; |
59 | private bool isSplit; | 58 | private bool isSplit = false; |
60 | private TcpServer mTcpServer; | 59 | 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 = SynchronizePackets; | 83 | ClientView.SynchronizeClient = new ClientView.SynchronizeClientHandler(SynchronizePackets); |
84 | AsynchronousSocketListener.PacketHandler = SynchronizePacketRecieve; | 84 | AsynchronousSocketListener.PacketHandler = new AsynchronousSocketListener.PacketRecieveHandler(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) | 149 | if (client.PacketProcessingEnabled == true) |
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) | 162 | if (client.PacketProcessingEnabled == true) |
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); | 181 | m_log.Error("[BALANCER] " + e.ToString()); |
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); | 202 | m_log.Error("[BALANCER] " + e.ToString()); |
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); | 226 | m_log.Error("[BALANCER] " + e.ToString()); |
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); | 250 | m_log.Error("[BALANCER] " + e.ToString()); |
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 = TerminateRegion; | 267 | WaitCallback callback = new WaitCallback(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); | 274 | m_log.Error("[BALANCER] " + e.ToString()); |
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[] {src_port, dst_port}; | 333 | int[] port = new int[] {src_port, dst_port}; |
334 | string[] url = new[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port}; | 334 | string[] url = new string[] {"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 + ".bin"; | 427 | filename = export_dir + "RegionInfo_" + src_region.RegionID.ToString() + ".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 + ".bin"; | 454 | filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode.ToString() + ".bin"; |
455 | 455 | ||
456 | Util.SerializeToFile(filename, info); | 456 | Util.SerializeToFile(filename, info); |
457 | 457 | ||
@@ -469,12 +469,13 @@ 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; | ||
472 | RegionInfo dst_region = null; | 473 | RegionInfo dst_region = null; |
473 | 474 | ||
474 | try | 475 | try |
475 | { | 476 | { |
476 | // deserialization of region data | 477 | // deserialization of region data |
477 | string[] files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); | 478 | files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); |
478 | 479 | ||
479 | foreach (string filename in files) | 480 | foreach (string filename in files) |
480 | { | 481 | { |
@@ -502,7 +503,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
502 | } | 503 | } |
503 | catch (Exception e) | 504 | catch (Exception e) |
504 | { | 505 | { |
505 | m_log.Error("[BALANCER] " + e); | 506 | m_log.Error("[BALANCER] " + e.ToString()); |
506 | m_log.Error("[BALANCER] " + e.StackTrace); | 507 | m_log.Error("[BALANCER] " + e.StackTrace); |
507 | throw e; | 508 | throw e; |
508 | } | 509 | } |
@@ -592,7 +593,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
592 | 593 | ||
593 | // change RegionInfo (memory only) | 594 | // change RegionInfo (memory only) |
594 | dst_region.InternalEndPoint.Port = dst_port; | 595 | dst_region.InternalEndPoint.Port = dst_port; |
595 | dst_region.ExternalHostName = proxyURL.Split(new[] {'/', ':'})[3]; | 596 | dst_region.ExternalHostName = proxyURL.Split(new char[] {'/', ':'})[3]; |
596 | 597 | ||
597 | // Create new region | 598 | // Create new region |
598 | simMain.CreateRegion(dst_region, false); | 599 | simMain.CreateRegion(dst_region, false); |
@@ -694,7 +695,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
694 | 695 | ||
695 | for (int i = 0; i < numRegions; i++) | 696 | for (int i = 0; i < numRegions; i++) |
696 | { | 697 | { |
697 | hostname = sceneURL[i].Split(new[] {'/', ':'})[3]; | 698 | hostname = sceneURL[i].Split(new char[] {'/', ':'})[3]; |
698 | m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); | 699 | m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); |
699 | tcpClientList[i] = new TcpClient(hostname, 10001); | 700 | tcpClientList[i] = new TcpClient(hostname, 10001); |
700 | } | 701 | } |
@@ -730,11 +731,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
730 | List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); | 731 | List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); |
731 | circuits.Sort(); | 732 | circuits.Sort(); |
732 | 733 | ||
734 | IClientAPI controller = null; | ||
735 | |||
733 | foreach (uint code in circuits) | 736 | foreach (uint code in circuits) |
734 | { | 737 | { |
735 | m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); | 738 | m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); |
736 | 739 | ||
737 | IClientAPI controller; | ||
738 | if (scene.ClientManager.TryGetClient(code, out controller)) | 740 | if (scene.ClientManager.TryGetClient(code, out controller)) |
739 | { | 741 | { |
740 | // Divide the presences evenly over the set of subscenes | 742 | // Divide the presences evenly over the set of subscenes |
@@ -754,7 +756,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
754 | } | 756 | } |
755 | 757 | ||
756 | scene.splitID = myID; | 758 | scene.splitID = myID; |
757 | scene.SynchronizeScene = SynchronizeScenes; | 759 | scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes); |
758 | isSplit = true; | 760 | isSplit = true; |
759 | } | 761 | } |
760 | else | 762 | else |
@@ -764,7 +766,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
764 | } | 766 | } |
765 | catch (Exception e) | 767 | catch (Exception e) |
766 | { | 768 | { |
767 | m_log.Error("[SPLITSCENE] " + e); | 769 | m_log.Error("[SPLITSCENE] " + e.ToString()); |
768 | m_log.Error("[SPLITSCENE] " + e.StackTrace); | 770 | m_log.Error("[SPLITSCENE] " + e.StackTrace); |
769 | } | 771 | } |
770 | 772 | ||
@@ -818,7 +820,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
818 | } | 820 | } |
819 | catch (Exception e) | 821 | catch (Exception e) |
820 | { | 822 | { |
821 | m_log.Error("[BALANCER] " + e); | 823 | m_log.Error("[BALANCER] " + e.ToString()); |
822 | m_log.Error("[BALANCER] " + e.StackTrace); | 824 | m_log.Error("[BALANCER] " + e.StackTrace); |
823 | throw e; | 825 | throw e; |
824 | } | 826 | } |
@@ -891,7 +893,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
891 | // Because data changes by the physics simulation when the client doesn't move, | 893 | // Because data changes by the physics simulation when the client doesn't move, |
892 | // if MovementFlag is false, It is necessary to synchronize. | 894 | // if MovementFlag is false, It is necessary to synchronize. |
893 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) | 895 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) |
894 | if (client.PacketProcessingEnabled) | 896 | if (client.PacketProcessingEnabled == true) |
895 | { | 897 | { |
896 | //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); | 898 | //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); |
897 | 899 | ||
@@ -1014,7 +1016,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1014 | return; | 1016 | return; |
1015 | } | 1017 | } |
1016 | 1018 | ||
1017 | if (((ClientView) pre.ControllingClient).PacketProcessingEnabled) | 1019 | if (((ClientView) pre.ControllingClient).PacketProcessingEnabled == true) |
1018 | { | 1020 | { |
1019 | pre.ControllingClient.OutPacket(packet, throttlePacketType); | 1021 | pre.ControllingClient.OutPacket(packet, throttlePacketType); |
1020 | } | 1022 | } |
@@ -1058,7 +1060,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1058 | } | 1060 | } |
1059 | catch (Exception e) | 1061 | catch (Exception e) |
1060 | { | 1062 | { |
1061 | m_log.Error("[SPLITSCENE] " + e); | 1063 | m_log.Error("[SPLITSCENE] " + e.ToString()); |
1062 | m_log.Error("[SPLITSCENE] " + e.StackTrace); | 1064 | m_log.Error("[SPLITSCENE] " + e.StackTrace); |
1063 | } | 1065 | } |
1064 | 1066 | ||
@@ -1070,7 +1072,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1070 | LLUUID scenePresenceID = new LLUUID(header.agent_id); | 1072 | LLUUID scenePresenceID = new LLUUID(header.agent_id); |
1071 | LLVector3 position = new LLVector3(buff, 0); | 1073 | LLVector3 position = new LLVector3(buff, 0); |
1072 | LLVector3 velocity = new LLVector3(buff, 12); | 1074 | LLVector3 velocity = new LLVector3(buff, 12); |
1073 | bool flying = ((buff[24] == 1) ? true : false); | 1075 | bool flying = ((buff[24] == (byte) 1) ? true : false); |
1074 | 1076 | ||
1075 | LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); | 1077 | LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); |
1076 | 1078 | ||
@@ -1084,4 +1086,4 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1084 | // m_log.Info("[SPLITSCENE] "+"exiting SynchronizePacketRecieve"); | 1086 | // m_log.Info("[SPLITSCENE] "+"exiting SynchronizePacketRecieve"); |
1085 | } | 1087 | } |
1086 | } | 1088 | } |
1087 | } \ No newline at end of file | 1089 | } |
diff --git a/ThirdParty/3Di/LoadBalancer/TcpClient.cs b/ThirdParty/3Di/LoadBalancer/TcpClient.cs index e9e019c..af678a0 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 readonly ManualResetEvent connectDone = new ManualResetEvent(false); | 37 | private static ManualResetEvent connectDone = new ManualResetEvent(false); |
38 | private static readonly ManualResetEvent sendDone = new ManualResetEvent(false); | 38 | private static 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, ConnectCallback, client); | 49 | client.BeginConnect(remoteEP, new AsyncCallback(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); | 74 | Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString()); |
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]; | ||
142 | public Guid agent_id; | 141 | 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 = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); | 153 | type = (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)); | 154 | throttlePacketType = (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)); | 155 | numbytes = (int) (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 = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); | 162 | region_port = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); |
163 | } | 163 | } |
164 | catch (Exception) | 164 | catch (Exception) |
165 | { | 165 | { |
@@ -201,11 +201,11 @@ 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 | |||
205 | private readonly string mHostname; | ||
206 | private readonly int mPort; | ||
207 | private Socket mConnection; | 204 | private Socket mConnection; |
208 | 205 | ||
206 | private string mHostname; | ||
207 | private int mPort; | ||
208 | |||
209 | public TcpClient(string hostname, int port) | 209 | public TcpClient(string hostname, int port) |
210 | { | 210 | { |
211 | mHostname = hostname; | 211 | mHostname = hostname; |
diff --git a/ThirdParty/3Di/LoadBalancer/TcpServer.cs b/ThirdParty/3Di/LoadBalancer/TcpServer.cs index cd94b95..9722a1b 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; | 40 | public InternalPacketHeader header = null; |
41 | public MemoryStream ms_ptr = new MemoryStream(); | 41 | public MemoryStream ms_ptr = new MemoryStream(); |
42 | public Socket workSocket; | 42 | public Socket workSocket = null; |
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; | 48 | public static string data = null; |
49 | 49 | ||
50 | #region KIRYU | 50 | #region KIRYU |
51 | 51 | ||
@@ -55,10 +55,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
55 | 55 | ||
56 | #endregion | 56 | #endregion |
57 | 57 | ||
58 | public static PacketRecieveHandler PacketHandler; | 58 | public static PacketRecieveHandler PacketHandler = null; |
59 | 59 | ||
60 | #endregion | 60 | #endregion |
61 | 61 | ||
62 | public AsynchronousSocketListener() | ||
63 | { | ||
64 | } | ||
65 | |||
62 | public static void StartListening(int port) | 66 | public static void StartListening(int port) |
63 | { | 67 | { |
64 | IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); | 68 | IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); |
@@ -195,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
195 | 199 | ||
196 | public class TcpServer | 200 | public class TcpServer |
197 | { | 201 | { |
198 | private readonly int mPort = 11000; | 202 | private int mPort = 11000; |
199 | 203 | ||
200 | public TcpServer() | 204 | public TcpServer() |
201 | { | 205 | { |