diff options
Diffstat (limited to 'ThirdParty/3Di/LoadBalancer')
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/TcpClient.cs | 7 | ||||
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/TcpServer.cs | 18 |
2 files changed, 4 insertions, 21 deletions
diff --git a/ThirdParty/3Di/LoadBalancer/TcpClient.cs b/ThirdParty/3Di/LoadBalancer/TcpClient.cs index 2e4cdc7..ab1f692 100644 --- a/ThirdParty/3Di/LoadBalancer/TcpClient.cs +++ b/ThirdParty/3Di/LoadBalancer/TcpClient.cs | |||
@@ -37,8 +37,6 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer { | |||
37 | public class AsynchronousClient { | 37 | public class AsynchronousClient { |
38 | private static ManualResetEvent connectDone = new ManualResetEvent(false); | 38 | private static ManualResetEvent connectDone = new ManualResetEvent(false); |
39 | private static ManualResetEvent sendDone = new ManualResetEvent(false); | 39 | private static ManualResetEvent sendDone = new ManualResetEvent(false); |
40 | private static ManualResetEvent receiveDone = new ManualResetEvent(false); | ||
41 | private static String response = String.Empty; | ||
42 | 40 | ||
43 | public static Socket StartClient(string hostname, int port) { | 41 | public static Socket StartClient(string hostname, int port) { |
44 | try { | 42 | try { |
@@ -114,7 +112,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer { | |||
114 | try { | 112 | try { |
115 | Socket client = (Socket) ar.AsyncState; | 113 | Socket client = (Socket) ar.AsyncState; |
116 | int bytesSent = client.EndSend(ar); | 114 | int bytesSent = client.EndSend(ar); |
117 | //Console.WriteLine("Sent {0} bytes to server.", bytesSent); | 115 | if(bytesSent > 0) |
116 | { | ||
117 | //Console.WriteLine("Sent {0} bytes to server.", bytesSent); | ||
118 | } | ||
118 | sendDone.Set(); | 119 | sendDone.Set(); |
119 | } catch (Exception e) { | 120 | } catch (Exception e) { |
120 | Console.WriteLine(e.ToString()); | 121 | Console.WriteLine(e.ToString()); |
diff --git a/ThirdParty/3Di/LoadBalancer/TcpServer.cs b/ThirdParty/3Di/LoadBalancer/TcpServer.cs index 2d46294..216db3b 100644 --- a/ThirdParty/3Di/LoadBalancer/TcpServer.cs +++ b/ThirdParty/3Di/LoadBalancer/TcpServer.cs | |||
@@ -89,7 +89,6 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer { | |||
89 | } | 89 | } |
90 | 90 | ||
91 | public static void ReadCallback(IAsyncResult ar) { | 91 | public static void ReadCallback(IAsyncResult ar) { |
92 | String content = String.Empty; | ||
93 | StateObject state = (StateObject) ar.AsyncState; | 92 | StateObject state = (StateObject) ar.AsyncState; |
94 | Socket handler = state.workSocket; | 93 | Socket handler = state.workSocket; |
95 | 94 | ||
@@ -183,23 +182,6 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer { | |||
183 | 182 | ||
184 | handler.BeginReceive( state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), state); | 183 | handler.BeginReceive( state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), state); |
185 | } | 184 | } |
186 | |||
187 | private static void Send(Socket handler, String data) { | ||
188 | byte[] byteData = Encoding.ASCII.GetBytes(data); | ||
189 | handler.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), handler); | ||
190 | } | ||
191 | |||
192 | private static void SendCallback(IAsyncResult ar) { | ||
193 | try { | ||
194 | Socket handler = (Socket) ar.AsyncState; | ||
195 | int bytesSent = handler.EndSend(ar); | ||
196 | //Console.WriteLine("Sent {0} bytes to client.", bytesSent); | ||
197 | handler.Shutdown(SocketShutdown.Both); | ||
198 | handler.Close(); | ||
199 | } catch (Exception e) { | ||
200 | Console.WriteLine(e.ToString()); | ||
201 | } | ||
202 | } | ||
203 | } | 185 | } |
204 | 186 | ||
205 | public class TcpServer { | 187 | public class TcpServer { |