aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs31
1 files changed, 20 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index b0b529c..6d72853 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -103,20 +103,19 @@ namespace OpenSim.Region.ClientStack
103 Packet packet = null; 103 Packet packet = null;
104 104
105 int numBytes; 105 int numBytes;
106 106
107 try 107 try
108 { 108 {
109 numBytes = Server.EndReceiveFrom(result, ref epSender); 109 numBytes = Server.EndReceiveFrom(result, ref epSender);
110 } 110 }
111 catch (System.Net.Sockets.SocketException) 111 catch (System.Net.Sockets.SocketException e)
112 { 112 {
113 Console.WriteLine("Remote host Closed connection"); 113 Console.WriteLine("Remote host Closed connection");
114
115 this.m_packetServer.CloseCircuit(this.clientCircuits[epSender]);
116 114
117 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 115 CloseEndPoint(epSender);
118 epSender = (EndPoint)ipeSender; 116
119 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 117 //Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
118
120 return; 119 return;
121 } 120 }
122 121
@@ -125,10 +124,11 @@ namespace OpenSim.Region.ClientStack
125 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); 124 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
126 125
127 // do we already have a circuit for this endpoint 126 // do we already have a circuit for this endpoint
128 if (this.clientCircuits.ContainsKey(epSender)) 127 uint circuit;
128 if (clientCircuits.TryGetValue(epSender, out circuit))
129 { 129 {
130 //if so then send packet to the packetserver 130 //if so then send packet to the packetserver
131 this.m_packetServer.InPacket(this.clientCircuits[epSender], packet); 131 this.m_packetServer.InPacket(circuit, packet);
132 } 132 }
133 else if (packet.Type == PacketType.UseCircuitCode) 133 else if (packet.Type == PacketType.UseCircuitCode)
134 { 134 {
@@ -143,12 +143,21 @@ namespace OpenSim.Region.ClientStack
143 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 143 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
144 } 144 }
145 145
146 private void CloseEndPoint(EndPoint sender)
147 {
148 uint circuit;
149 if (clientCircuits.TryGetValue(sender, out circuit))
150 {
151 m_packetServer.CloseCircuit(circuit);
152 }
153 }
154
146 protected virtual void AddNewClient(Packet packet) 155 protected virtual void AddNewClient(Packet packet)
147 { 156 {
148 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 157 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
149 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 158 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
150 159
151 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); 160 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass);
152 } 161 }
153 162
154 public void ServerListener() 163 public void ServerListener()
@@ -206,6 +215,6 @@ namespace OpenSim.Region.ClientStack
206 } 215 }
207 } 216 }
208 217
209 218
210 } 219 }
211} \ No newline at end of file 220} \ No newline at end of file