Update svn properties.
parent
b7f80ec0b7
commit
dd828956e6
File diff suppressed because it is too large
Load Diff
|
@ -1,87 +1,87 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using MXP;
|
using MXP;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Client.MXP.PacketHandler;
|
using OpenSim.Client.MXP.PacketHandler;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Client.MXP
|
namespace OpenSim.Client.MXP
|
||||||
{
|
{
|
||||||
public class MXPModule : IRegionModule
|
public class MXPModule : IRegionModule
|
||||||
{
|
{
|
||||||
private int mxp_Port = 1253;
|
private int mxp_Port = 1253;
|
||||||
private double mxp_BubbleRadius = 181.01933598375616624661615669884; // Radius of a sphere big enough to encapsulate a 256x256 square
|
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 readonly Timer ticker = new Timer(100);
|
||||||
|
|
||||||
private int ticks;
|
private int ticks;
|
||||||
private bool shutdown = false;
|
private bool shutdown = false;
|
||||||
|
|
||||||
private IConfigSource config;
|
private IConfigSource config;
|
||||||
|
|
||||||
private readonly Dictionary<UUID,Scene> m_scenes = new Dictionary<UUID, Scene>();
|
private readonly Dictionary<UUID,Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||||
|
|
||||||
private MXPPacketServer server;
|
private MXPPacketServer server;
|
||||||
|
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
m_scenes.Add(scene.RegionInfo.RegionID, scene);
|
m_scenes.Add(scene.RegionInfo.RegionID, scene);
|
||||||
config = source;
|
config = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (config.Configs["MXP"] != null)
|
if (config.Configs["MXP"] != null)
|
||||||
{
|
{
|
||||||
IConfig con = config.Configs["MXP"];
|
IConfig con = config.Configs["MXP"];
|
||||||
|
|
||||||
if(!con.GetBoolean("Enabled",false))
|
if(!con.GetBoolean("Enabled",false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mxp_Port = con.GetInt("Port", mxp_Port);
|
mxp_Port = con.GetInt("Port", mxp_Port);
|
||||||
|
|
||||||
|
|
||||||
server = new MXPPacketServer("http://null", mxp_Port, m_scenes);
|
server = new MXPPacketServer("http://null", mxp_Port, m_scenes);
|
||||||
|
|
||||||
ticker.AutoReset = false;
|
ticker.AutoReset = false;
|
||||||
ticker.Elapsed += ticker_Elapsed;
|
ticker.Elapsed += ticker_Elapsed;
|
||||||
|
|
||||||
ticker.Start();
|
ticker.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ticker_Elapsed(object sender, ElapsedEventArgs e)
|
void ticker_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
server.Process();
|
server.Process();
|
||||||
|
|
||||||
if (!shutdown)
|
if (!shutdown)
|
||||||
ticker.Start();
|
ticker.Start();
|
||||||
|
|
||||||
if(++ticks % 100 == 0)
|
if(++ticks % 100 == 0)
|
||||||
{
|
{
|
||||||
server.PrintDebugInformation();
|
server.PrintDebugInformation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
ticker.Stop();
|
ticker.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "MXP ClientStack Module"; }
|
get { return "MXP ClientStack Module"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public bool IsSharedModule
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Client.MXP
|
namespace OpenSim.Client.MXP
|
||||||
{
|
{
|
||||||
static class MXPUtil
|
static class MXPUtil
|
||||||
{
|
{
|
||||||
public static string GenerateMXPURL(string server, int port, UUID bubbleID, Vector3 location)
|
public static string GenerateMXPURL(string server, int port, UUID bubbleID, Vector3 location)
|
||||||
{
|
{
|
||||||
return string.Format("mxp://{0}:{1}/{2}/{3}", server, port, bubbleID.Guid, location);
|
return string.Format("mxp://{0}:{1}/{2}/{3}", server, port, bubbleID.Guid, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,368 +1,368 @@
|
||||||
/* This file borrows heavily from MXPServer.cs - the reference MXPServer
|
/* This file borrows heavily from MXPServer.cs - the reference MXPServer
|
||||||
* See http://www.bubblecloud.org for a copy of the original file and
|
* See http://www.bubblecloud.org for a copy of the original file and
|
||||||
* implementation details. */
|
* implementation details. */
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using MXP;
|
using MXP;
|
||||||
using MXP.Messages;
|
using MXP.Messages;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Client.MXP.ClientStack;
|
using OpenSim.Client.MXP.ClientStack;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Client.MXP.PacketHandler
|
namespace OpenSim.Client.MXP.PacketHandler
|
||||||
{
|
{
|
||||||
class MXPPacketServer
|
class MXPPacketServer
|
||||||
{
|
{
|
||||||
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private readonly List<MXPClientView> Clients = new List<MXPClientView>();
|
private readonly List<MXPClientView> Clients = new List<MXPClientView>();
|
||||||
private readonly Dictionary<UUID, Scene> Scenes;
|
private readonly Dictionary<UUID, Scene> Scenes;
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly Transmitter transmitter;
|
private readonly Transmitter transmitter;
|
||||||
|
|
||||||
private readonly IList<Session> sessions = new List<Session>();
|
private readonly IList<Session> sessions = new List<Session>();
|
||||||
private readonly IList<MXPClientView> sessionsToRemove = new List<MXPClientView>();
|
private readonly IList<MXPClientView> sessionsToRemove = new List<MXPClientView>();
|
||||||
|
|
||||||
private readonly String cloudUrl;
|
private readonly String cloudUrl;
|
||||||
private readonly String programName;
|
private readonly String programName;
|
||||||
private readonly byte programMajorVersion;
|
private readonly byte programMajorVersion;
|
||||||
private readonly byte programMinorVersion;
|
private readonly byte programMinorVersion;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public MXPPacketServer(string cloudUrl, int port, Dictionary<UUID, Scene> scenes)
|
public MXPPacketServer(string cloudUrl, int port, Dictionary<UUID, Scene> scenes)
|
||||||
{
|
{
|
||||||
this.cloudUrl = cloudUrl;
|
this.cloudUrl = cloudUrl;
|
||||||
|
|
||||||
Scenes = scenes;
|
Scenes = scenes;
|
||||||
|
|
||||||
programMinorVersion = 63;
|
programMinorVersion = 63;
|
||||||
programMajorVersion = 0;
|
programMajorVersion = 0;
|
||||||
programName = "OpenSimulator";
|
programName = "OpenSimulator";
|
||||||
|
|
||||||
transmitter = new Transmitter(port);
|
transmitter = new Transmitter(port);
|
||||||
transmitter.Startup();
|
transmitter.Startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of sessions pending. (Process() accepts pending sessions).
|
/// Number of sessions pending. (Process() accepts pending sessions).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PendingSessionCount
|
public int PendingSessionCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter.PendingSessionCount;
|
return transmitter.PendingSessionCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of connected sessions.
|
/// Number of connected sessions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SessionCount
|
public int SessionCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return sessions.Count;
|
return sessions.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Property reflecting whether client transmitter threads are alive.
|
/// Property reflecting whether client transmitter threads are alive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsTransmitterAlive
|
public bool IsTransmitterAlive
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter != null && transmitter.IsAlive;
|
return transmitter != null && transmitter.IsAlive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of packets sent.
|
/// Number of packets sent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong PacketsSent
|
public ulong PacketsSent
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter != null ? transmitter.PacketsSent : 0;
|
return transmitter != null ? transmitter.PacketsSent : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of packets received.
|
/// Number of packets received.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong PacketsReceived
|
public ulong PacketsReceived
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter != null ? transmitter.PacketsReceived : 0;
|
return transmitter != null ? transmitter.PacketsReceived : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bytes client has received so far.
|
/// Bytes client has received so far.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong BytesReceived
|
public ulong BytesReceived
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter != null ? transmitter.BytesReceived : 0;
|
return transmitter != null ? transmitter.BytesReceived : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bytes client has sent so far.
|
/// Bytes client has sent so far.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong BytesSent
|
public ulong BytesSent
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter != null ? transmitter.BytesSent : 0;
|
return transmitter != null ? transmitter.BytesSent : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of bytes received (bytes per second) during past second.
|
/// Number of bytes received (bytes per second) during past second.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double ReceiveRate
|
public double ReceiveRate
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter != null ? transmitter.ReceiveRate : 0;
|
return transmitter != null ? transmitter.ReceiveRate : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of bytes sent (bytes per second) during past second.
|
/// Number of bytes sent (bytes per second) during past second.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double SendRate
|
public double SendRate
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return transmitter != null ? transmitter.SendRate : 0;
|
return transmitter != null ? transmitter.SendRate : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Session Management
|
#region Session Management
|
||||||
|
|
||||||
public void Disconnect(Session session)
|
public void Disconnect(Session session)
|
||||||
{
|
{
|
||||||
if (session.IsConnected)
|
if (session.IsConnected)
|
||||||
{
|
{
|
||||||
Message message = MessageFactory.Current.ReserveMessage(typeof(LeaveRequestMessage));
|
Message message = MessageFactory.Current.ReserveMessage(typeof(LeaveRequestMessage));
|
||||||
session.Send(message);
|
session.Send(message);
|
||||||
MessageFactory.Current.ReleaseMessage(message);
|
MessageFactory.Current.ReleaseMessage(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Not connected.");
|
throw new Exception("Not connected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Processing
|
#region Processing
|
||||||
|
|
||||||
public void PrintDebugInformation()
|
public void PrintDebugInformation()
|
||||||
{
|
{
|
||||||
m_log.Info("[MXP ClientStack] Statistics report");
|
m_log.Info("[MXP ClientStack] Statistics report");
|
||||||
m_log.Info("Pending Sessions: " + PendingSessionCount);
|
m_log.Info("Pending Sessions: " + PendingSessionCount);
|
||||||
m_log.Info("Sessions: " + SessionCount + " (Clients: " + Clients.Count + " )");
|
m_log.Info("Sessions: " + SessionCount + " (Clients: " + Clients.Count + " )");
|
||||||
m_log.Info("Transmitter Alive?: " + IsTransmitterAlive);
|
m_log.Info("Transmitter Alive?: " + IsTransmitterAlive);
|
||||||
m_log.Info("Packets Sent/Recieved: " + PacketsSent + " / " + PacketsReceived);
|
m_log.Info("Packets Sent/Recieved: " + PacketsSent + " / " + PacketsReceived);
|
||||||
m_log.Info("Bytes Sent/Recieved: " + BytesSent + " / " + BytesReceived);
|
m_log.Info("Bytes Sent/Recieved: " + BytesSent + " / " + BytesReceived);
|
||||||
m_log.Info("Send/Recieve Rate (bps): " + SendRate + " / " + ReceiveRate);
|
m_log.Info("Send/Recieve Rate (bps): " + SendRate + " / " + ReceiveRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process()
|
public void Process()
|
||||||
{
|
{
|
||||||
ProcessMessages();
|
ProcessMessages();
|
||||||
Clean();
|
Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clean()
|
public void Clean()
|
||||||
{
|
{
|
||||||
foreach (MXPClientView clientView in Clients)
|
foreach (MXPClientView clientView in Clients)
|
||||||
{
|
{
|
||||||
if (clientView.Session.SessionState == SessionState.Disconnected)
|
if (clientView.Session.SessionState == SessionState.Disconnected)
|
||||||
{
|
{
|
||||||
sessionsToRemove.Add(clientView);
|
sessionsToRemove.Add(clientView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (MXPClientView clientView in sessionsToRemove)
|
foreach (MXPClientView clientView in sessionsToRemove)
|
||||||
{
|
{
|
||||||
clientView.Scene.RemoveClient(clientView.AgentId);
|
clientView.Scene.RemoveClient(clientView.AgentId);
|
||||||
Clients.Remove(clientView);
|
Clients.Remove(clientView);
|
||||||
sessions.Remove(clientView.Session);
|
sessions.Remove(clientView.Session);
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionsToRemove.Clear();
|
sessionsToRemove.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AuthoriseUser(string participantName, string pass, UUID scene)
|
public bool AuthoriseUser(string participantName, string pass, UUID scene)
|
||||||
{
|
{
|
||||||
if (Scenes.ContainsKey(scene))
|
if (Scenes.ContainsKey(scene))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProcessMessages()
|
public void ProcessMessages()
|
||||||
{
|
{
|
||||||
if (transmitter.PendingSessionCount > 0)
|
if (transmitter.PendingSessionCount > 0)
|
||||||
{
|
{
|
||||||
sessions.Add(transmitter.AcceptPendingSession());
|
sessions.Add(transmitter.AcceptPendingSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (MXPClientView clientView in Clients)
|
foreach (MXPClientView clientView in Clients)
|
||||||
{
|
{
|
||||||
|
|
||||||
int messagesProcessedCount = 0;
|
int messagesProcessedCount = 0;
|
||||||
Session session = clientView.Session;
|
Session session = clientView.Session;
|
||||||
|
|
||||||
while (session.AvailableMessages > 0)
|
while (session.AvailableMessages > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
Message message = session.Receive();
|
Message message = session.Receive();
|
||||||
|
|
||||||
if (message.GetType() == typeof(JoinRequestMessage))
|
if (message.GetType() == typeof(JoinRequestMessage))
|
||||||
{
|
{
|
||||||
|
|
||||||
JoinRequestMessage joinRequestMessage = (JoinRequestMessage)message;
|
JoinRequestMessage joinRequestMessage = (JoinRequestMessage)message;
|
||||||
|
|
||||||
bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName,
|
bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName,
|
||||||
joinRequestMessage.ParticipantPassphrase,
|
joinRequestMessage.ParticipantPassphrase,
|
||||||
new UUID(joinRequestMessage.BubbleId));
|
new UUID(joinRequestMessage.BubbleId));
|
||||||
|
|
||||||
if (authorized)
|
if (authorized)
|
||||||
{
|
{
|
||||||
Scene target = Scenes[new UUID(joinRequestMessage.BubbleId)];
|
Scene target = Scenes[new UUID(joinRequestMessage.BubbleId)];
|
||||||
|
|
||||||
UUID mxpSessionID = UUID.Random();
|
UUID mxpSessionID = UUID.Random();
|
||||||
|
|
||||||
m_log.Info("[MXP ClientStack] Session join request success: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
m_log.Info("[MXP ClientStack] Session join request success: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
||||||
|
|
||||||
AcceptConnection(session, joinRequestMessage, mxpSessionID);
|
AcceptConnection(session, joinRequestMessage, mxpSessionID);
|
||||||
|
|
||||||
MXPClientView client = new MXPClientView(session, mxpSessionID, target,
|
MXPClientView client = new MXPClientView(session, mxpSessionID, target,
|
||||||
joinRequestMessage.ParticipantName);
|
joinRequestMessage.ParticipantName);
|
||||||
Clients.Add(client);
|
Clients.Add(client);
|
||||||
|
|
||||||
target.AddNewClient(client);
|
target.AddNewClient(client);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Info("[MXP ClientStack] Session join request failure: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
m_log.Info("[MXP ClientStack] Session join request failure: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
||||||
|
|
||||||
DeclineConnection(session, joinRequestMessage);
|
DeclineConnection(session, joinRequestMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (message.GetType() == typeof(LeaveRequestMessage))
|
if (message.GetType() == typeof(LeaveRequestMessage))
|
||||||
{
|
{
|
||||||
|
|
||||||
LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)MessageFactory.Current.ReserveMessage(
|
LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)MessageFactory.Current.ReserveMessage(
|
||||||
typeof(LeaveResponseMessage));
|
typeof(LeaveResponseMessage));
|
||||||
|
|
||||||
m_log.Info("[MXP ClientStack] Session leave request: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
m_log.Info("[MXP ClientStack] Session leave request: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
||||||
|
|
||||||
leaveResponseMessage.RequestMessageId = message.MessageId;
|
leaveResponseMessage.RequestMessageId = message.MessageId;
|
||||||
leaveResponseMessage.FailureCode = 0;
|
leaveResponseMessage.FailureCode = 0;
|
||||||
session.Send(leaveResponseMessage);
|
session.Send(leaveResponseMessage);
|
||||||
|
|
||||||
if (session.SessionState != SessionState.Disconnected)
|
if (session.SessionState != SessionState.Disconnected)
|
||||||
{
|
{
|
||||||
session.SetStateDisconnected();
|
session.SetStateDisconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[MXP ClientStack] Removing Client from Scene");
|
m_log.Info("[MXP ClientStack] Removing Client from Scene");
|
||||||
clientView.Scene.RemoveClient(clientView.AgentId);
|
clientView.Scene.RemoveClient(clientView.AgentId);
|
||||||
}
|
}
|
||||||
if (message.GetType() == typeof(LeaveResponseMessage))
|
if (message.GetType() == typeof(LeaveResponseMessage))
|
||||||
{
|
{
|
||||||
|
|
||||||
LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)message;
|
LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)message;
|
||||||
|
|
||||||
m_log.Info("[MXP ClientStack] Session leave response: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
m_log.Info("[MXP ClientStack] Session leave response: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
|
||||||
|
|
||||||
if (leaveResponseMessage.FailureCode == 0)
|
if (leaveResponseMessage.FailureCode == 0)
|
||||||
{
|
{
|
||||||
session.SetStateDisconnected();
|
session.SetStateDisconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[MXP ClientStack] Removing Client from Scene");
|
m_log.Info("[MXP ClientStack] Removing Client from Scene");
|
||||||
clientView.Scene.RemoveClient(clientView.AgentId);
|
clientView.Scene.RemoveClient(clientView.AgentId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clientView.ProcessMXPPacket(message);
|
clientView.ProcessMXPPacket(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageFactory.Current.ReleaseMessage(message);
|
MessageFactory.Current.ReleaseMessage(message);
|
||||||
messagesProcessedCount++;
|
messagesProcessedCount++;
|
||||||
if (messagesProcessedCount > 1000)
|
if (messagesProcessedCount > 1000)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID)
|
private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID)
|
||||||
{
|
{
|
||||||
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(
|
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(
|
||||||
typeof(JoinResponseMessage));
|
typeof(JoinResponseMessage));
|
||||||
|
|
||||||
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
||||||
joinResponseMessage.FailureCode = 0;
|
joinResponseMessage.FailureCode = 0;
|
||||||
|
|
||||||
joinResponseMessage.ParticipantId = mxpSessionID.Guid;
|
joinResponseMessage.ParticipantId = mxpSessionID.Guid;
|
||||||
joinResponseMessage.CloudUrl = cloudUrl;
|
joinResponseMessage.CloudUrl = cloudUrl;
|
||||||
|
|
||||||
joinResponseMessage.BubbleName = Scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
|
joinResponseMessage.BubbleName = Scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
|
||||||
|
|
||||||
joinResponseMessage.BubbleRealTime = 0;
|
joinResponseMessage.BubbleRealTime = 0;
|
||||||
joinResponseMessage.ProgramName = programName;
|
joinResponseMessage.ProgramName = programName;
|
||||||
joinResponseMessage.ProgramMajorVersion = programMajorVersion;
|
joinResponseMessage.ProgramMajorVersion = programMajorVersion;
|
||||||
joinResponseMessage.ProgramMinorVersion = programMinorVersion;
|
joinResponseMessage.ProgramMinorVersion = programMinorVersion;
|
||||||
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
|
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
|
||||||
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
|
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
|
||||||
|
|
||||||
session.Send(joinResponseMessage);
|
session.Send(joinResponseMessage);
|
||||||
|
|
||||||
session.SetStateConnected();
|
session.SetStateConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeclineConnection(Session session, Message joinRequestMessage)
|
private void DeclineConnection(Session session, Message joinRequestMessage)
|
||||||
{
|
{
|
||||||
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(typeof(JoinResponseMessage));
|
JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(typeof(JoinResponseMessage));
|
||||||
|
|
||||||
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
|
||||||
joinResponseMessage.FailureCode = 1;
|
joinResponseMessage.FailureCode = 1;
|
||||||
|
|
||||||
joinResponseMessage.CloudUrl = cloudUrl;
|
joinResponseMessage.CloudUrl = cloudUrl;
|
||||||
|
|
||||||
joinResponseMessage.BubbleName = "Declined OpenSim Region"; // Dont reveal anything about the sim in the disconnect notice
|
joinResponseMessage.BubbleName = "Declined OpenSim Region"; // Dont reveal anything about the sim in the disconnect notice
|
||||||
|
|
||||||
joinResponseMessage.BubbleRealTime = 0;
|
joinResponseMessage.BubbleRealTime = 0;
|
||||||
joinResponseMessage.ProgramName = programName;
|
joinResponseMessage.ProgramName = programName;
|
||||||
joinResponseMessage.ProgramMajorVersion = programMajorVersion;
|
joinResponseMessage.ProgramMajorVersion = programMajorVersion;
|
||||||
joinResponseMessage.ProgramMinorVersion = programMinorVersion;
|
joinResponseMessage.ProgramMinorVersion = programMinorVersion;
|
||||||
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
|
joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
|
||||||
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
|
joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
|
||||||
|
|
||||||
session.Send(joinResponseMessage);
|
session.Send(joinResponseMessage);
|
||||||
|
|
||||||
session.SetStateDisconnected();
|
session.SetStateDisconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
MXP Reference Implementation
|
MXP Reference Implementation
|
||||||
Code availible from: http://setp.googlecode.com/svn/trunk/
|
Code availible from: http://setp.googlecode.com/svn/trunk/
|
||||||
http://www.bubblecloud.org
|
http://www.bubblecloud.org
|
||||||
|
|
||||||
|
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
1. Definitions.
|
1. Definitions.
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||||
|
|
||||||
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||||
|
|
||||||
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||||
|
|
||||||
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||||
|
|
||||||
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
Loading…
Reference in New Issue