* Gave Connectivity some more (manly) love.

afrisby
lbsa71 2007-09-18 21:51:09 +00:00
parent 70d9cec3b5
commit c8f51836b8
1 changed files with 20 additions and 11 deletions

View File

@ -108,15 +108,14 @@ namespace OpenSim.Region.ClientStack
{ {
numBytes = Server.EndReceiveFrom(result, ref epSender); numBytes = Server.EndReceiveFrom(result, ref epSender);
} }
catch (System.Net.Sockets.SocketException) catch (System.Net.Sockets.SocketException e)
{ {
Console.WriteLine("Remote host Closed connection"); Console.WriteLine("Remote host Closed connection");
this.m_packetServer.CloseCircuit(this.clientCircuits[epSender]); CloseEndPoint(epSender);
//Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
epSender = (EndPoint)ipeSender;
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
return; return;
} }
@ -125,10 +124,11 @@ namespace OpenSim.Region.ClientStack
packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
// do we already have a circuit for this endpoint // do we already have a circuit for this endpoint
if (this.clientCircuits.ContainsKey(epSender)) uint circuit;
if (clientCircuits.TryGetValue(epSender, out circuit))
{ {
//if so then send packet to the packetserver //if so then send packet to the packetserver
this.m_packetServer.InPacket(this.clientCircuits[epSender], packet); this.m_packetServer.InPacket(circuit, packet);
} }
else if (packet.Type == PacketType.UseCircuitCode) else if (packet.Type == PacketType.UseCircuitCode)
{ {
@ -143,6 +143,15 @@ namespace OpenSim.Region.ClientStack
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
} }
private void CloseEndPoint(EndPoint sender)
{
uint circuit;
if (clientCircuits.TryGetValue(sender, out circuit))
{
m_packetServer.CloseCircuit(circuit);
}
}
protected virtual void AddNewClient(Packet packet) protected virtual void AddNewClient(Packet packet)
{ {
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;