aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/3Di/LoadBalancer/TcpClient.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ThirdParty/3Di/LoadBalancer/TcpClient.cs30
1 files changed, 12 insertions, 18 deletions
diff --git a/ThirdParty/3Di/LoadBalancer/TcpClient.cs b/ThirdParty/3Di/LoadBalancer/TcpClient.cs
index ddd40cc..c794def 100644
--- a/ThirdParty/3Di/LoadBalancer/TcpClient.cs
+++ b/ThirdParty/3Di/LoadBalancer/TcpClient.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
29using System.Net; 30using System.Net;
30using System.Net.Sockets; 31using System.Net.Sockets;
31using System.Threading; 32using System.Threading;
@@ -115,24 +116,17 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
115 116
116 public void FromBytes(byte[] bytes) 117 public void FromBytes(byte[] bytes)
117 { 118 {
118 int i = 0; // offset 119 MemoryStream memstr = new MemoryStream(bytes);
119 try 120 memstr.Seek(0, SeekOrigin.Begin);
120 { 121 BinaryReader binread = new BinaryReader(memstr);
121 type = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 122
122 throttlePacketType = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 123 type = binread.ReadInt32();
123 numbytes = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); 124 throttlePacketType = binread.ReadInt32();
124 agent_id = new Guid( 125 numbytes = binread.ReadInt32();
125 bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24, 126 agent_id = new Guid(binread.ReadBytes(16));
126 (short) (bytes[i++] | (bytes[i++] << 8)), 127 region_port = binread.ReadInt32();
127 (short) (bytes[i++] | (bytes[i++] << 8)), 128
128 bytes[i++], bytes[i++], bytes[i++], bytes[i++], 129 binread.Close();
129 bytes[i++], bytes[i++], bytes[i++], bytes[i++]);
130 region_port = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
131 }
132 catch (Exception)
133 {
134 throw new Exception("bad format!!!");
135 }
136 } 130 }
137 131
138 public byte[] ToBytes() 132 public byte[] ToBytes()