* Added /even more/ debugging messages to the UDP server to help people in resolving the Sakai issue. A few locks a few fixes, nothing that'll solve the problem in itself though.

ThreadPoolClientBranch
Teravus Ovares 2008-02-18 05:32:25 +00:00
parent 2c81e18fc3
commit 27afeaec74
2 changed files with 72 additions and 8 deletions

View File

@ -476,6 +476,7 @@ namespace OpenSim.Region.ClientStack
{ {
//session/circuit not authorised //session/circuit not authorised
m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString()); m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString());
m_packetQueue.Flush();
m_packetQueue.Close(); m_packetQueue.Close();
m_clientThread.Abort(); m_clientThread.Abort();
} }

View File

@ -111,7 +111,7 @@ namespace OpenSim.Region.ClientStack
epSender = (EndPoint) ipeSender; epSender = (EndPoint) ipeSender;
Packet packet = null; Packet packet = null;
int numBytes; int numBytes = 1;
try try
{ {
@ -173,8 +173,9 @@ namespace OpenSim.Region.ClientStack
// Stupid I know.. // Stupid I know..
// but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
} }
catch (SocketException) catch (SocketException e2)
{ {
m_log.Error("[UDPSERVER]: " + e2.ToString());
} }
// Here's some reference code! :D // Here's some reference code! :D
@ -187,12 +188,28 @@ namespace OpenSim.Region.ClientStack
break; break;
} }
return; //return;
} }
catch (ObjectDisposedException e) catch (ObjectDisposedException e)
{ {
m_log.Debug("[UDPSERVER]: " + e.ToString()); m_log.Debug("[UDPSERVER]: " + e.ToString());
return; try
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
// so therefore.. we've got to tell the server to BeginReceiveFrom again.
// This will happen over and over until we've gone through all packets
// sent to and from this particular user.
// Stupid I know..
// but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
}
catch (SocketException e2)
{
m_log.Error("[UDPSERVER]: " + e2.ToString());
}
//return;
} }
int packetEnd = numBytes - 1; int packetEnd = numBytes - 1;
@ -221,8 +238,17 @@ namespace OpenSim.Region.ClientStack
{ {
// new client // new client
m_log.Debug("[UDPSERVER]: Adding New Client"); m_log.Debug("[UDPSERVER]: Adding New Client");
try
{
AddNewClient(packet); AddNewClient(packet);
} }
catch (Exception e3)
{
m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString());
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null);
}
}
else else
{ {
// invalid client // invalid client
@ -231,9 +257,39 @@ namespace OpenSim.Region.ClientStack
} }
} }
try
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
} }
catch (SocketException e4)
{
try
{
CloseEndPoint(epSender);
}
catch (Exception a)
{
m_log.Info("[UDPSERVER]: " + a.ToString());
}
try
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
// so therefore.. we've got to tell the server to BeginReceiveFrom again.
// This will happen over and over until we've gone through all packets
// sent to and from this particular user.
// Stupid I know..
// but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
}
catch (SocketException e5)
{
m_log.Error("[UDPSERVER]: " + e5.ToString());
}
}
}
private void CloseEndPoint(EndPoint sender) private void CloseEndPoint(EndPoint sender)
{ {
@ -247,8 +303,15 @@ namespace OpenSim.Region.ClientStack
protected virtual void AddNewClient(Packet packet) protected virtual void AddNewClient(Packet packet)
{ {
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet;
lock (clientCircuits)
{
clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
}
lock (clientCircuits_reverse)
{
if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code))
clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender); clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender);
}
PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass);
} }