Thank you tlaukkan for a patch that: Upgraded to MXP 0.4 version and cleaned up field naming.

* Updated code to compile against MXP 0.4 version.
* Cleaned up field naming conventions.
* Added support for logging in with region name.
* Filled in new fields of JoinResponseMEssage.
* Added support for SynchronizationBeginEvent and SynchronizationEndEvent.
* Commented out periodic debug log.
* Added networking startup log messages.

This closes mantis #3277
0.6.4-rc1
lbsa71 2009-03-08 19:33:19 +00:00
parent 2fa57a2970
commit 4f23718102
6 changed files with 202 additions and 142 deletions

View File

@ -41,6 +41,7 @@ using Packet=OpenMetaverse.Packets.Packet;
using MXP.Extentions.OpenMetaverseFragments.Proto;
using MXP.Util;
using MXP.Fragments;
using MXP.Common.Proto;
namespace OpenSim.Client.MXP.ClientStack
{
@ -64,9 +65,10 @@ namespace OpenSim.Client.MXP.ClientStack
private readonly IScene m_scene;
private readonly string m_firstName;
private readonly string m_lastName;
private int m_objectsToSynchronize = 0;
private int m_objectsSynchronized = -1;
private Vector3 m_startPosition=new Vector3(128f, 128f, 128f);
//private int m_debugLevel;
#endregion
#region Properties
@ -181,7 +183,7 @@ namespace OpenSim.Client.MXP.ClientStack
}
else
{
m_log.Warn("[MXP] Received messaged unhandled: " + message);
m_log.Warn("[MXP ClientStack] Received messaged unhandled: " + message);
}
}
@ -249,7 +251,13 @@ namespace OpenSim.Client.MXP.ClientStack
if (avatarExt.Body != null)
{
agentUpdate.HeadRotation = FromOmQuaternion(avatarExt.Body.HeadOrientation);
foreach(OmBipedBoneOrientation boneOrientation in avatarExt.Body.BipedBoneOrientations)
{
if (boneOrientation.Bone == OmBipedBones.Head)
{
agentUpdate.HeadRotation = FromOmQuaternion(boneOrientation.Orientation);
}
}
}
else
{
@ -295,7 +303,7 @@ namespace OpenSim.Client.MXP.ClientStack
private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
{
String typeName = ToOmType(primShape.PCode);
m_log.Info("[MXP] Transmitting Primitive" + typeName);
m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName);
PerceptionEventMessage pe = new PerceptionEventMessage();
@ -307,16 +315,16 @@ namespace OpenSim.Client.MXP.ClientStack
pe.ObjectFragment.OwnerId = ownerID.Guid;
pe.ObjectFragment.TypeId = Guid.Empty;
pe.ObjectFragment.TypeName = typeName;
pe.ObjectFragment.Acceleration = new float[] { acc.X, acc.Y, acc.Z };
pe.ObjectFragment.AngularAcceleration = new float[4];
pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f };
pe.ObjectFragment.Acceleration = ToOmVector(acc);
pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f();
pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel);
pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
pe.ObjectFragment.Location = new float[] { pos.X, pos.Y, pos.Z };
pe.ObjectFragment.Location = ToOmVector(pos);
pe.ObjectFragment.Mass = 1.0f;
pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z };
pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
pe.ObjectFragment.Velocity =ToOmVector(vel);
OmSlPrimitiveExt ext = new OmSlPrimitiveExt();
@ -360,11 +368,23 @@ namespace OpenSim.Client.MXP.ClientStack
pe.SetExtension<OmSlPrimitiveExt>(ext);
Session.Send(pe);
if (m_objectsSynchronized != -1)
{
m_objectsSynchronized++;
if (m_objectsToSynchronize >= m_objectsSynchronized)
{
SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage();
Session.Send(synchronizationEndEventMessage);
m_objectsSynchronized = -1;
}
}
}
public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation)
{
m_log.Info("[MXP] Transmitting Avatar Data " + participantName);
m_log.Info("[MXP ClientStack] Transmitting Avatar Data " + participantName);
PerceptionEventMessage pe = new PerceptionEventMessage();
@ -376,23 +396,23 @@ namespace OpenSim.Client.MXP.ClientStack
pe.ObjectFragment.OwnerId = ownerID.Guid;
pe.ObjectFragment.TypeId = Guid.Empty;
pe.ObjectFragment.TypeName = "Avatar";
pe.ObjectFragment.Acceleration = new float[3];
pe.ObjectFragment.AngularAcceleration = new float[4];
pe.ObjectFragment.AngularVelocity = new float[4];
pe.ObjectFragment.Acceleration = new MsdVector3f();
pe.ObjectFragment.AngularAcceleration = new MsdQuaternion4f();
pe.ObjectFragment.AngularVelocity = new MsdQuaternion4f();
pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value
pe.ObjectFragment.Location = new float[] { position.X, position.Y, position.Z };
pe.ObjectFragment.Location = ToOmVector(position);
pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value
pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
pe.ObjectFragment.Velocity = new float[3];
pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
pe.ObjectFragment.Velocity = new MsdVector3f();
Session.Send(pe);
}
public void MXPSendTerrain(float[] map)
{
m_log.Info("[MXP] Transmitting terrain for " + m_scene.RegionInfo.RegionName);
m_log.Info("[MXP ClientStack] Transmitting terrain for " + m_scene.RegionInfo.RegionName);
PerceptionEventMessage pe = new PerceptionEventMessage();
@ -404,16 +424,16 @@ namespace OpenSim.Client.MXP.ClientStack
pe.ObjectFragment.OwnerId = m_scene.RegionInfo.MasterAvatarAssignedUUID.Guid;
pe.ObjectFragment.TypeId = Guid.Empty;
pe.ObjectFragment.TypeName = "Terrain";
pe.ObjectFragment.Acceleration = new float[3];
pe.ObjectFragment.AngularAcceleration = new float[4];
pe.ObjectFragment.AngularVelocity = new float[4];
pe.ObjectFragment.Acceleration = new MsdVector3f();
pe.ObjectFragment.AngularAcceleration = new MsdQuaternion4f();
pe.ObjectFragment.AngularVelocity = new MsdQuaternion4f();
pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value
pe.ObjectFragment.Location = new float[] { 0, 0, 0 };
pe.ObjectFragment.Location = new MsdVector3f();
pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value
pe.ObjectFragment.Orientation = new float[] { 0, 0, 0, 0 };
pe.ObjectFragment.Velocity = new float[3];
pe.ObjectFragment.Orientation = new MsdQuaternion4f();
pe.ObjectFragment.Velocity = new MsdVector3f();
OmBitmapTerrainExt terrainExt = new OmBitmapTerrainExt();
terrainExt.Width = 256;
@ -421,37 +441,68 @@ namespace OpenSim.Client.MXP.ClientStack
terrainExt.WaterLevel = (float) m_scene.RegionInfo.RegionSettings.WaterHeight;
terrainExt.Offset = 0;
terrainExt.Scale = 10;
terrainExt.HeightMap = CompressionUtil.CompressHeightMap(map, 0, 10);
terrainExt.HeightMap = CompressUtil.CompressHeightMap(map, 0, 10);
pe.SetExtension<OmBitmapTerrainExt>(terrainExt);
Session.Send(pe);
}
public void MXPSentSynchronizationBegin(int objectCount)
{
m_objectsToSynchronize = objectCount;
m_objectsSynchronized = 0;
SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage();
synchronizationBeginEventMessage.ObjectCount = (uint)objectCount;
Session.Send(synchronizationBeginEventMessage);
}
#endregion
#region MXP Conversions
private OmVector3f ToOmVector(Vector3 value)
private MsdVector3f ToOmVector(Vector3 value)
{
OmVector3f encodedValue = new OmVector3f();
MsdVector3f encodedValue = new MsdVector3f();
encodedValue.X = value.X;
encodedValue.Y = value.Y;
encodedValue.Z = value.Z;
return encodedValue;
}
private Vector3 FromOmVector(OmVector3f vector)
private MsdQuaternion4f ToOmQuaternion(Vector3 value)
{
Quaternion quaternion=Quaternion.CreateFromEulers(value);
MsdQuaternion4f encodedValue = new MsdQuaternion4f();
encodedValue.X = quaternion.X;
encodedValue.Y = quaternion.Y;
encodedValue.Z = quaternion.Z;
encodedValue.W = quaternion.W;
return encodedValue;
}
private MsdQuaternion4f ToOmQuaternion(Quaternion value)
{
MsdQuaternion4f encodedValue = new MsdQuaternion4f();
encodedValue.X = value.X;
encodedValue.Y = value.Y;
encodedValue.Z = value.Z;
encodedValue.W = value.W;
return encodedValue;
}
private Vector3 FromOmVector(MsdVector3f vector)
{
return new Vector3(vector.X, vector.Y, vector.Z);
}
private Vector3 FromOmVector(float[] vector)
{
return new Vector3(vector[0], vector[1], vector[2]);
}
private Quaternion FromOmQuaternion(OmQuaternion4f quaternion)
private Quaternion FromOmQuaternion(MsdQuaternion4f quaternion)
{
return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W);
}
@ -461,9 +512,9 @@ namespace OpenSim.Client.MXP.ClientStack
return new Quaternion(quaternion[0], quaternion[1], quaternion[2], quaternion[3]);
}
private OmColor4f ToOmColor(byte[] value)
private MsdColor4f ToOmColor(byte[] value)
{
OmColor4f encodedValue = new OmColor4f();
MsdColor4f encodedValue = new MsdColor4f();
encodedValue.R = value[0];
encodedValue.G = value[1];
encodedValue.B = value[2];
@ -750,18 +801,6 @@ namespace OpenSim.Client.MXP.ClientStack
public void Start()
{
Scene.AddNewClient(this);
/*foreach (ScenePresence presence in ((Scene)Scene).GetScenePresences())
{
if (presence.Appearance!=null)
{
AvatarAppearance avatar = presence.Appearance;
if (presence.Appearance.Owner == m_userID)
{
MXPSendAvatarData(m_firstName + " " + m_lastName, presence.Appearance.Owner, UUID.Zero, presence.UUID, presence.LocalId, presence.AbsolutePosition, presence.Rotation);
}
}
}*/
}
public void Stop()
@ -799,7 +838,7 @@ namespace OpenSim.Client.MXP.ClientStack
public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
{
m_log.Info("[MXP] Completing Handshake to Region");
m_log.Info("[MXP ClientStack] Completing Handshake to Region");
if (OnRegionHandShakeReply != null)
{
@ -820,9 +859,8 @@ namespace OpenSim.Client.MXP.ClientStack
chatActionEvent.ActionFragment.ActionName = "Chat";
chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid;
chatActionEvent.ActionFragment.ObservationRadius = 180.0f;
chatActionEvent.ActionFragment.ActionPayloadDialect = "TEXT";
chatActionEvent.ActionFragment.ExtensionDialect = "TEXT";
chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message));
chatActionEvent.ActionFragment.ActionPayloadLength = (uint)chatActionEvent.GetPayloadData().Length;
Session.Send(chatActionEvent);
}
@ -938,8 +976,8 @@ namespace OpenSim.Client.MXP.ClientStack
{
MovementEventMessage me = new MovementEventMessage();
me.ObjectIndex = localID;
me.Location = new float[] { position.X, position.Y, position.Z };
me.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
me.Location =ToOmVector(position);
me.Orientation = ToOmQuaternion(rotation);
Session.Send(me);
}
@ -973,9 +1011,8 @@ namespace OpenSim.Client.MXP.ClientStack
{
MovementEventMessage me = new MovementEventMessage();
me.ObjectIndex = localID;
me.Location = new float[] {position.X, position.Y, position.Z};
me.Orientation = new float[] {rotation.X, rotation.Y, rotation.Z, rotation.W};
me.Location = ToOmVector(position);
me.Orientation = ToOmQuaternion(rotation);
Session.Send(me);
}

View File

@ -40,65 +40,64 @@ namespace OpenSim.Client.MXP
{
public class MXPModule : IRegionModule
{
private int mxp_Port = 1253;
//private double mxp_BubbleRadius = 181.01933598375616624661615669884; // Radius of a sphere big enough to encapsulate a 256x256 square
private readonly Timer ticker = new Timer(100);
private int ticks;
private bool shutdown = false;
private IConfigSource config;
private int m_port = 1253;
//private int m_ticks = 0;
private bool m_shutdown = false;
private IConfigSource m_config;
private readonly Timer m_ticker = new Timer(100);
private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
private MXPPacketServer server;
private MXPPacketServer m_server;
public void Initialise(Scene scene, IConfigSource source)
{
if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID))
m_scenes.Add(scene.RegionInfo.RegionID, scene);
config = source;
m_config = source;
}
public void PostInitialise()
{
if (config.Configs["MXP"] != null)
if (m_config.Configs["MXP"] != null)
{
IConfig con = config.Configs["MXP"];
IConfig con = m_config.Configs["MXP"];
if (!con.GetBoolean("Enabled", false))
return;
mxp_Port = con.GetInt("Port", mxp_Port);
m_port = con.GetInt("Port", m_port);
server = new MXPPacketServer("http://null", mxp_Port, m_scenes);
m_server = new MXPPacketServer(m_port, m_scenes);
ticker.AutoReset = false;
ticker.Elapsed += ticker_Elapsed;
m_ticker.AutoReset = false;
m_ticker.Elapsed += ticker_Elapsed;
ticker.Start();
m_ticker.Start();
}
}
void ticker_Elapsed(object sender, ElapsedEventArgs e)
{
server.Process();
m_server.Process();
if (!shutdown)
ticker.Start();
if (!m_shutdown)
m_ticker.Start();
if (++ticks % 100 == 0)
// Commenting this at because of the excess flood to log.
// TODO: Add ini file option.
/*if (++ticks % 100 == 0)
{
server.PrintDebugInformation();
}
}*/
}
public void Close()
{
shutdown = true;
ticker.Stop();
m_shutdown = true;
m_ticker.Stop();
}
public string Name
@ -110,5 +109,6 @@ namespace OpenSim.Client.MXP
{
get { return true; }
}
}
}

View File

@ -32,7 +32,7 @@ using OpenMetaverse;
namespace OpenSim.Client.MXP
{
static class MXPUtil
public static class MXPUtil
{
public static string GenerateMXPURL(string server, int port, UUID bubbleID, Vector3 location)
{

View File

@ -42,43 +42,43 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Client.MXP.PacketHandler
{
class MXPPacketServer
public class MXPPacketServer
{
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<MXPClientView> Clients = new List<MXPClientView>();
private readonly Dictionary<UUID, Scene> Scenes;
#region Fields
private readonly Transmitter transmitter;
private readonly List<MXPClientView> m_clients = new List<MXPClientView>();
private readonly Dictionary<UUID, Scene> m_scenes;
private readonly Transmitter m_transmitter;
private readonly Thread m_clientThread;
private readonly IList<Session> sessions = new List<Session>();
private readonly IList<Session> sessionsToClient = new List<Session>();
private readonly IList<MXPClientView> sessionsToRemove = new List<MXPClientView>();
private readonly IList<Session> m_sessions = new List<Session>();
private readonly IList<Session> m_sessionsToClient = new List<Session>();
private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
private readonly String cloudUrl;
private readonly String programName;
private readonly byte programMajorVersion;
private readonly byte programMinorVersion;
private readonly int m_port;
private readonly String m_programName;
private readonly byte m_programMajorVersion;
private readonly byte m_programMinorVersion;
#endregion
#region Constructors
public MXPPacketServer(string cloudUrl, int port, Dictionary<UUID, Scene> scenes)
public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes)
{
this.cloudUrl = cloudUrl;
this.m_port = port;
Scenes = scenes;
m_scenes = scenes;
programMinorVersion = 63;
programMajorVersion = 0;
programName = "OpenSimulator";
transmitter = new Transmitter(port);
m_programMinorVersion = 63;
m_programMajorVersion = 0;
m_programName = "OpenSimulator";
m_transmitter = new Transmitter(port);
m_clientThread = new Thread(StartListener);
m_clientThread.Name = "MXPThread";
@ -89,7 +89,9 @@ namespace OpenSim.Client.MXP.PacketHandler
public void StartListener()
{
transmitter.Startup();
m_log.Info("[MXP ClientStack] Transmitter starting on UDP server port: " + m_port);
m_transmitter.Startup();
m_log.Info("[MXP ClientStack] Transmitter started. MXP version: "+MxpConstants.ProtocolMajorVersion+"."+MxpConstants.ProtocolMinorVersion+" Source Revision: "+MxpConstants.ProtocolSourceRevision);
}
#endregion
@ -103,7 +105,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter.PendingSessionCount;
return m_transmitter.PendingSessionCount;
}
}
/// <summary>
@ -113,7 +115,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return sessions.Count;
return m_sessions.Count;
}
}
/// <summary>
@ -123,7 +125,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter != null && transmitter.IsAlive;
return m_transmitter != null && m_transmitter.IsAlive;
}
}
/// <summary>
@ -133,7 +135,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter != null ? transmitter.PacketsSent : 0;
return m_transmitter != null ? m_transmitter.PacketsSent : 0;
}
}
/// <summary>
@ -143,7 +145,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter != null ? transmitter.PacketsReceived : 0;
return m_transmitter != null ? m_transmitter.PacketsReceived : 0;
}
}
/// <summary>
@ -153,7 +155,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter != null ? transmitter.BytesReceived : 0;
return m_transmitter != null ? m_transmitter.BytesReceived : 0;
}
}
/// <summary>
@ -163,7 +165,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter != null ? transmitter.BytesSent : 0;
return m_transmitter != null ? m_transmitter.BytesSent : 0;
}
}
/// <summary>
@ -173,7 +175,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter != null ? transmitter.ReceiveRate : 0;
return m_transmitter != null ? m_transmitter.ReceiveRate : 0;
}
}
/// <summary>
@ -183,7 +185,7 @@ namespace OpenSim.Client.MXP.PacketHandler
{
get
{
return transmitter != null ? transmitter.SendRate : 0;
return m_transmitter != null ? m_transmitter.SendRate : 0;
}
}
@ -207,18 +209,17 @@ namespace OpenSim.Client.MXP.PacketHandler
#endregion
#region Processing
public void PrintDebugInformation()
{
m_log.Info("[MXP ClientStack] Statistics report");
m_log.Info("Pending Sessions: " + PendingSessionCount);
m_log.Info("Sessions: " + SessionCount + " (Clients: " + Clients.Count + " )");
m_log.Info("Sessions: " + SessionCount + " (Clients: " + m_clients.Count + " )");
m_log.Info("Transmitter Alive?: " + IsTransmitterAlive);
m_log.Info("Packets Sent/Received: " + PacketsSent + " / " + PacketsReceived);
m_log.Info("Bytes Sent/Received: " + BytesSent + " / " + BytesReceived);
m_log.Info("Send/Recieve Rate (bps): " + SendRate + " / " + ReceiveRate);
m_log.Info("Send/Receive Rate (bps): " + SendRate + " / " + ReceiveRate);
}
public void Process()
@ -229,22 +230,22 @@ namespace OpenSim.Client.MXP.PacketHandler
public void Clean()
{
foreach (MXPClientView clientView in Clients)
foreach (MXPClientView clientView in m_clients)
{
if (clientView.Session.SessionState == SessionState.Disconnected)
{
sessionsToRemove.Add(clientView);
m_sessionsToRemove.Add(clientView);
}
}
foreach (MXPClientView clientView in sessionsToRemove)
foreach (MXPClientView clientView in m_sessionsToRemove)
{
clientView.Scene.RemoveClient(clientView.AgentId);
Clients.Remove(clientView);
sessions.Remove(clientView.Session);
m_clients.Remove(clientView);
m_sessions.Remove(clientView.Session);
}
sessionsToRemove.Clear();
m_sessionsToRemove.Clear();
}
public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UUID userId, out string firstName, out string lastName)
@ -253,7 +254,7 @@ namespace OpenSim.Client.MXP.PacketHandler
firstName = "";
lastName = "";
if (!Scenes.ContainsKey(sceneId))
if (!m_scenes.ContainsKey(sceneId))
{
m_log.Info("Login failed as region was not found: " + sceneId);
return false;
@ -268,7 +269,7 @@ namespace OpenSim.Client.MXP.PacketHandler
firstName = nameParts[0];
lastName = nameParts[1];
UserProfileData userProfile = Scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName);
UserProfileData userProfile = m_scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName);
if (userProfile == null)
{
m_log.Info("Login failed as user was not found: " + participantName);
@ -288,17 +289,17 @@ namespace OpenSim.Client.MXP.PacketHandler
public void ProcessMessages()
{
if (transmitter.PendingSessionCount > 0)
if (m_transmitter.PendingSessionCount > 0)
{
Session tmp = transmitter.AcceptPendingSession();
sessions.Add(tmp);
sessionsToClient.Add(tmp);
Session tmp = m_transmitter.AcceptPendingSession();
m_sessions.Add(tmp);
m_sessionsToClient.Add(tmp);
}
List<Session> tmpRemove = new List<Session>();
foreach (Session session in sessionsToClient)
foreach (Session session in m_sessionsToClient)
{
while (session.AvailableMessages > 0)
{
@ -313,13 +314,30 @@ namespace OpenSim.Client.MXP.PacketHandler
string firstName;
string lastName;
if (joinRequestMessage.BubbleId == Guid.Empty)
{
foreach (Scene scene in m_scenes.Values)
{
if (scene.RegionInfo.RegionName == joinRequestMessage.BubbleName)
{
m_log.Info("Resolved region by name: " + joinRequestMessage.BubbleName + " (" + scene.RegionInfo.RegionID+")");
joinRequestMessage.BubbleId = scene.RegionInfo.RegionID.Guid;
}
}
}
if (joinRequestMessage.BubbleId == Guid.Empty)
{
m_log.Warn("Failed to resolve region by name: "+joinRequestMessage.BubbleName);
}
bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName,
joinRequestMessage.ParticipantPassphrase,
new UUID(joinRequestMessage.BubbleId), out userId, out firstName, out lastName);
if (authorized)
{
Scene target = Scenes[new UUID(joinRequestMessage.BubbleId)];
Scene target = m_scenes[new UUID(joinRequestMessage.BubbleId)];
UUID mxpSessionID = UUID.Random();
@ -332,12 +350,15 @@ namespace OpenSim.Client.MXP.PacketHandler
MXPClientView client = new MXPClientView(session, mxpSessionID,userId, target,
firstName, lastName);
m_log.Info("[MXP ClientStack] Created Client");
Clients.Add(client);
m_clients.Add(client);
m_log.Info("[MXP ClientStack] Adding to Scene");
target.ClientManager.Add(client.CircuitCode, client);
m_log.Info("[MXP ClientStack] Initialising...");
client.MXPSentSynchronizationBegin(m_scenes[new UUID(joinRequestMessage.BubbleId)].SceneContents.GetTotalObjectsCount());
try
{
client.Start();
@ -365,10 +386,10 @@ namespace OpenSim.Client.MXP.PacketHandler
foreach (Session session in tmpRemove)
{
sessionsToClient.Remove(session);
m_sessionsToClient.Remove(session);
}
foreach (MXPClientView clientView in Clients)
foreach (MXPClientView clientView in m_clients)
{
int messagesProcessedCount = 0;
Session session = clientView.Session;
@ -431,19 +452,24 @@ namespace OpenSim.Client.MXP.PacketHandler
typeof(JoinResponseMessage));
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
joinResponseMessage.FailureCode = 0;
joinResponseMessage.FailureCode = MxpResponseCodes.SUCCESS;
joinResponseMessage.BubbleId = joinRequestMessage.BubbleId;
joinResponseMessage.ParticipantId = userId.Guid;
joinResponseMessage.CloudUrl = cloudUrl;
joinResponseMessage.AvatarId = userId.Guid;
joinResponseMessage.BubbleAssetCacheUrl = m_scenes[new UUID(joinRequestMessage.BubbleId)].CommsManager.NetworkServersInfo.AssetURL;
joinResponseMessage.BubbleName = Scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
joinResponseMessage.BubbleName = m_scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
joinResponseMessage.BubbleRange = 128;
joinResponseMessage.BubblePerceptionRange = 128 + 256;
joinResponseMessage.BubbleRealTime = 0;
joinResponseMessage.ProgramName = programName;
joinResponseMessage.ProgramMajorVersion = programMajorVersion;
joinResponseMessage.ProgramMinorVersion = programMinorVersion;
joinResponseMessage.ProgramName = m_programName;
joinResponseMessage.ProgramMajorVersion = m_programMajorVersion;
joinResponseMessage.ProgramMinorVersion = m_programMinorVersion;
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
joinResponseMessage.ProtocolSourceRevision = MxpConstants.ProtocolSourceRevision;
session.Send(joinResponseMessage);
@ -455,18 +481,14 @@ namespace OpenSim.Client.MXP.PacketHandler
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(typeof(JoinResponseMessage));
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
joinResponseMessage.FailureCode = 1;
joinResponseMessage.FailureCode = MxpResponseCodes.UNAUTHORIZED_OPERATION;
joinResponseMessage.CloudUrl = cloudUrl;
joinResponseMessage.BubbleName = "Declined OpenSim Region"; // Dont reveal anything about the sim in the disconnect notice
joinResponseMessage.BubbleRealTime = 0;
joinResponseMessage.ProgramName = programName;
joinResponseMessage.ProgramMajorVersion = programMajorVersion;
joinResponseMessage.ProgramMinorVersion = programMinorVersion;
joinResponseMessage.ProgramName = m_programName;
joinResponseMessage.ProgramMajorVersion = m_programMajorVersion;
joinResponseMessage.ProgramMinorVersion = m_programMinorVersion;
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
joinResponseMessage.ProtocolSourceRevision = MxpConstants.ProtocolSourceRevision;
session.Send(joinResponseMessage);
@ -474,5 +496,6 @@ namespace OpenSim.Client.MXP.PacketHandler
}
#endregion
}
}

Binary file not shown.

Binary file not shown.