Restore the functionality that was removed in r9928. This lets the load

balancer plugin work again. Create a new method, GetClientEP, to retrieve
only the EndPoint for script usage. Marked the purpose of the method
in IClientAPI.cs with a warning. Also restored the corresponding SetClientInfo
functionality.
trunk
Melanie Thielker 2009-07-01 15:47:52 +00:00
parent 3f2fba610e
commit 3564271c2d
10 changed files with 85 additions and 48 deletions

View File

@ -1417,6 +1417,11 @@ namespace OpenSim.Client.MXP.ClientStack
Session.Send(lrm); Session.Send(lrm);
} }
public EndPoint GetClientEP()
{
return null;
}
public ClientInfo GetClientInfo() public ClientInfo GetClientInfo()
{ {
return null; return null;

View File

@ -942,6 +942,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
public EndPoint GetClientEP()
{
return null;
}
public ClientInfo GetClientInfo() public ClientInfo GetClientInfo()
{ {
throw new System.NotImplementedException(); throw new System.NotImplementedException();

View File

@ -1108,9 +1108,16 @@ namespace OpenSim.Framework
void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message); void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message);
void SendLogoutPacket(); void SendLogoutPacket();
ClientInfo GetClientInfo(); EndPoint GetClientEP();
// WARNING WARNING WARNING
//
// The two following methods are EXCLUSIVELY for the load balancer.
// they cause a MASSIVE performance hit!
//
ClientInfo GetClientInfo();
void SetClientInfo(ClientInfo info); void SetClientInfo(ClientInfo info);
void SetClientOption(string option, string value); void SetClientOption(string option, string value);
string GetClientOption(string option); string GetClientOption(string option);
void Terminate(); void Terminate();

View File

@ -9919,6 +9919,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return info; return info;
} }
public EndPoint GetClientEP()
{
return m_userEndPoint;
}
public void SetClientInfo(ClientInfo info) public void SetClientInfo(ClientInfo info)
{ {
m_PacketHandler.SetClientInfo(info); m_PacketHandler.SetClientInfo(info);

View File

@ -643,28 +643,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
ClientInfo info = new ClientInfo(); ClientInfo info = new ClientInfo();
// nobody seems to even look at the following data. since info.pendingAcks = m_PendingAcksMap;
// it's a rather expensive operation (lock, serializing info.needAck = new Dictionary<uint, byte[]>();
// packets, copying it into dictionary, etc) i've
// commented out the expensive (but unwanted?) bits below
// (dr scofield, 2009-06-24)
// info.pendingAcks = m_PendingAcks; lock (m_NeedAck)
// info.needAck = new Dictionary<uint, byte[]>(); {
foreach (uint key in m_NeedAck.Keys)
info.needAck.Add(key, m_NeedAck[key].Packet.ToBytes());
}
// lock (m_NeedAck) LLQueItem[] queitems = m_PacketQueue.GetQueueArray();
// {
// foreach (uint key in m_NeedAck.Keys)
// info.needAck.Add(key, m_NeedAck[key].Packet.ToBytes());
// }
// LLQueItem[] queitems = m_PacketQueue.GetQueueArray(); for (int i = 0; i < queitems.Length; i++)
{
// for (int i = 0; i < queitems.Length; i++) if (queitems[i].Incoming == false)
// { info.out_packets.Add(queitems[i].Packet.ToBytes());
// if (queitems[i].Incoming == false) }
// info.out_packets.Add(queitems[i].Packet.ToBytes());
// }
info.sequence = m_Sequence; info.sequence = m_Sequence;
@ -683,37 +677,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SetClientInfo(ClientInfo info) public void SetClientInfo(ClientInfo info)
{ {
// m_PendingAcks = info.pendingAcks; m_PendingAcksMap = info.pendingAcks;
// m_NeedAck = new Dictionary<uint, LLQueItem>(); m_PendingAcks = new List<uint>(m_PendingAcksMap.Keys);
m_NeedAck = new Dictionary<uint, LLQueItem>();
// Packet packet = null; Packet packet = null;
// int packetEnd = 0; int packetEnd = 0;
// byte[] zero = new byte[3000]; byte[] zero = new byte[3000];
// foreach (uint key in info.needAck.Keys) foreach (uint key in info.needAck.Keys)
// { {
// byte[] buff = info.needAck[key]; byte[] buff = info.needAck[key];
// packetEnd = buff.Length - 1; packetEnd = buff.Length - 1;
// try try
// { {
// packet = PacketPool.Instance.GetPacket(buff, ref packetEnd, zero); packet = PacketPool.Instance.GetPacket(buff, ref packetEnd, zero);
// } }
// catch (Exception) catch (Exception)
// { {
// } }
// LLQueItem item = new LLQueItem(); LLQueItem item = new LLQueItem();
// item.Packet = packet; item.Packet = packet;
// item.Incoming = false; item.Incoming = false;
// item.throttleType = 0; item.throttleType = 0;
// item.TickCount = Environment.TickCount; item.TickCount = Environment.TickCount;
// item.Identifier = 0; item.Identifier = 0;
// item.Resends = 0; item.Resends = 0;
// item.Length = packet.Length; item.Length = packet.Length;
// item.Sequence = packet.Header.Sequence; item.Sequence = packet.Header.Sequence;
// m_NeedAck.Add(key, item); m_NeedAck.Add(key, item);
// } }
m_Sequence = info.sequence; m_Sequence = info.sequence;

View File

@ -843,6 +843,11 @@ namespace OpenSim.Region.Examples.SimpleModule
{ {
} }
public EndPoint GetClientEP()
{
return null;
}
public ClientInfo GetClientInfo() public ClientInfo GetClientInfo()
{ {
return null; return null;

View File

@ -1396,6 +1396,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
Disconnect(); Disconnect();
} }
public EndPoint GetClientEP()
{
return null;
}
public ClientInfo GetClientInfo() public ClientInfo GetClientInfo()
{ {
return new ClientInfo(); return new ClientInfo();

View File

@ -855,6 +855,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
} }
public EndPoint GetClientEP()
{
return null;
}
public ClientInfo GetClientInfo() public ClientInfo GetClientInfo()
{ {
return null; return null;

View File

@ -666,7 +666,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence)
{ {
ScenePresence target = (ScenePresence)World.Entities[avatarID]; ScenePresence target = (ScenePresence)World.Entities[avatarID];
EndPoint ep = target.ControllingClient.GetClientInfo().userEP; EndPoint ep = target.ControllingClient.GetClientEP();
if (ep is IPEndPoint) if (ep is IPEndPoint)
{ {
IPEndPoint ip = (IPEndPoint)ep; IPEndPoint ip = (IPEndPoint)ep;

View File

@ -888,6 +888,11 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public EndPoint GetClientEP()
{
return null;
}
public ClientInfo GetClientInfo() public ClientInfo GetClientInfo()
{ {
return null; return null;