Merge branch 'master' into varregion

varregion
Robert Adams 2013-10-07 13:58:17 -07:00
commit 86bf79aa2b
68 changed files with 243 additions and 71 deletions

View File

@ -30,7 +30,7 @@ using Mono.Addins;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]
[assembly: Addin("OpenSim.Groups", "0.1")] [assembly: Addin("OpenSim.Groups", "0.1")]
[assembly: AddinDependency("OpenSim", "0.5")] [assembly: AddinDependency("OpenSim", "0.5")]

View File

@ -30,7 +30,7 @@ using Mono.Addins;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]
[assembly: Addin("OpenSim.OfflineIM", "0.1")] [assembly: Addin("OpenSim.OfflineIM", "0.1")]
[assembly: AddinDependency("OpenSim", "0.5")] [assembly: AddinDependency("OpenSim", "0.5")]

View File

@ -62,4 +62,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("0.7.6.*")] // [assembly: AssemblyVersion("0.7.6.*")]
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -59,4 +59,4 @@ using System.Runtime.InteropServices;
// Revision // Revision
// //
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -28,8 +28,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading;
using HttpServer; using HttpServer;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
@ -98,6 +100,8 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary> /// </summary>
public ValidateHandshake HandshakeValidateMethodOverride = null; public ValidateHandshake HandshakeValidateMethodOverride = null;
private ManualResetEvent _receiveDone = new ManualResetEvent(false);
private OSHttpRequest _request; private OSHttpRequest _request;
private HTTPNetworkContext _networkContext; private HTTPNetworkContext _networkContext;
private IHttpClientContext _clientContext; private IHttpClientContext _clientContext;
@ -109,6 +113,8 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool _closing; private bool _closing;
private bool _upgraded; private bool _upgraded;
private int _maxPayloadBytes = 41943040; private int _maxPayloadBytes = 41943040;
private int _initialMsgTimeout = 0;
private int _defaultReadTimeout = 10000;
private const string HandshakeAcceptText = private const string HandshakeAcceptText =
"HTTP/1.1 101 Switching Protocols\r\n" + "HTTP/1.1 101 Switching Protocols\r\n" +
@ -131,6 +137,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
_request = preq; _request = preq;
_networkContext = pContext.GiveMeTheNetworkStreamIKnowWhatImDoing(); _networkContext = pContext.GiveMeTheNetworkStreamIKnowWhatImDoing();
_networkContext.Stream.ReadTimeout = _defaultReadTimeout;
_clientContext = pContext; _clientContext = pContext;
_bufferLength = bufferlen; _bufferLength = bufferlen;
_buffer = new byte[_bufferLength]; _buffer = new byte[_bufferLength];
@ -205,6 +212,16 @@ namespace OpenSim.Framework.Servers.HttpServer
set { _maxPayloadBytes = value; } set { _maxPayloadBytes = value; }
} }
/// <summary>
/// Set this to the maximum amount of milliseconds to wait for the first complete message to be sent or received on the websocket after upgrading
/// Default, it waits forever. Use this when your Websocket consuming code opens a connection and waits for a message from the other side to avoid a Denial of Service vector.
/// </summary>
public int InitialMsgTimeout
{
get { return _initialMsgTimeout; }
set { _initialMsgTimeout = value; }
}
/// <summary> /// <summary>
/// This triggers the websocket start the upgrade process /// This triggers the websocket start the upgrade process
/// </summary> /// </summary>
@ -245,6 +262,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string rawaccept = string.Format(HandshakeAcceptText, acceptKey); string rawaccept = string.Format(HandshakeAcceptText, acceptKey);
SendUpgradeSuccess(rawaccept); SendUpgradeSuccess(rawaccept);
} }
else else
{ {
@ -258,6 +276,10 @@ namespace OpenSim.Framework.Servers.HttpServer
SendUpgradeSuccess(rawaccept); SendUpgradeSuccess(rawaccept);
} }
} }
public IPEndPoint GetRemoteIPEndpoint()
{
return _request.RemoteIPEndPoint;
}
/// <summary> /// <summary>
/// Generates a handshake response key string based on the client's /// Generates a handshake response key string based on the client's
@ -290,9 +312,16 @@ namespace OpenSim.Framework.Servers.HttpServer
WebSocketState socketState = new WebSocketState() { ReceivedBytes = new List<byte>(), Header = WebsocketFrameHeader.HeaderDefault(), FrameComplete = true}; WebSocketState socketState = new WebSocketState() { ReceivedBytes = new List<byte>(), Header = WebsocketFrameHeader.HeaderDefault(), FrameComplete = true};
byte[] bhandshakeResponse = Encoding.UTF8.GetBytes(pHandshakeResponse); byte[] bhandshakeResponse = Encoding.UTF8.GetBytes(pHandshakeResponse);
try try
{ {
if (_initialMsgTimeout > 0)
{
_receiveDone.Reset();
}
// Begin reading the TCP stream before writing the Upgrade success message to the other side of the stream. // Begin reading the TCP stream before writing the Upgrade success message to the other side of the stream.
_networkContext.Stream.BeginRead(_buffer, 0, _bufferLength, OnReceive, socketState); _networkContext.Stream.BeginRead(_buffer, 0, _bufferLength, OnReceive, socketState);
@ -303,6 +332,11 @@ namespace OpenSim.Framework.Servers.HttpServer
UpgradeCompletedDelegate d = OnUpgradeCompleted; UpgradeCompletedDelegate d = OnUpgradeCompleted;
if (d != null) if (d != null)
d(this, new UpgradeCompletedEventArgs()); d(this, new UpgradeCompletedEventArgs());
if (_initialMsgTimeout > 0)
{
if (!_receiveDone.WaitOne(TimeSpan.FromMilliseconds(_initialMsgTimeout)))
Close(string.Empty);
}
} }
catch (IOException) catch (IOException)
{ {
@ -489,6 +523,11 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <param name="message">the string message that is to be sent</param> /// <param name="message">the string message that is to be sent</param>
public void SendMessage(string message) public void SendMessage(string message)
{ {
if (_initialMsgTimeout > 0)
{
_receiveDone.Set();
_initialMsgTimeout = 0;
}
byte[] messagedata = Encoding.UTF8.GetBytes(message); byte[] messagedata = Encoding.UTF8.GetBytes(message);
WebSocketFrame textMessageFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = messagedata }; WebSocketFrame textMessageFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = messagedata };
textMessageFrame.Header.Opcode = WebSocketReader.OpCode.Text; textMessageFrame.Header.Opcode = WebSocketReader.OpCode.Text;
@ -499,6 +538,11 @@ namespace OpenSim.Framework.Servers.HttpServer
public void SendData(byte[] data) public void SendData(byte[] data)
{ {
if (_initialMsgTimeout > 0)
{
_receiveDone.Set();
_initialMsgTimeout = 0;
}
WebSocketFrame dataMessageFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = data}; WebSocketFrame dataMessageFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = data};
dataMessageFrame.Header.IsEnd = true; dataMessageFrame.Header.IsEnd = true;
dataMessageFrame.Header.Opcode = WebSocketReader.OpCode.Binary; dataMessageFrame.Header.Opcode = WebSocketReader.OpCode.Binary;
@ -531,6 +575,11 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary> /// </summary>
public void SendPingCheck() public void SendPingCheck()
{ {
if (_initialMsgTimeout > 0)
{
_receiveDone.Set();
_initialMsgTimeout = 0;
}
WebSocketFrame pingFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = new byte[0] }; WebSocketFrame pingFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = new byte[0] };
pingFrame.Header.Opcode = WebSocketReader.OpCode.Ping; pingFrame.Header.Opcode = WebSocketReader.OpCode.Ping;
pingFrame.Header.IsEnd = true; pingFrame.Header.IsEnd = true;
@ -544,6 +593,11 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <param name="message"></param> /// <param name="message"></param>
public void Close(string message) public void Close(string message)
{ {
if (_initialMsgTimeout > 0)
{
_receiveDone.Set();
_initialMsgTimeout = 0;
}
if (_networkContext == null) if (_networkContext == null)
return; return;
if (_networkContext.Stream != null) if (_networkContext.Stream != null)
@ -583,7 +637,11 @@ namespace OpenSim.Framework.Servers.HttpServer
WebSocketReader.Mask(psocketState.Header.Mask, unmask); WebSocketReader.Mask(psocketState.Header.Mask, unmask);
psocketState.ReceivedBytes = new List<byte>(unmask); psocketState.ReceivedBytes = new List<byte>(unmask);
} }
if (psocketState.Header.Opcode != WebSocketReader.OpCode.Continue && _initialMsgTimeout > 0)
{
_receiveDone.Set();
_initialMsgTimeout = 0;
}
switch (psocketState.Header.Opcode) switch (psocketState.Header.Opcode)
{ {
case WebSocketReader.OpCode.Ping: case WebSocketReader.OpCode.Ping:
@ -696,6 +754,11 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
public void Dispose() public void Dispose()
{ {
if (_initialMsgTimeout > 0)
{
_receiveDone.Set();
_initialMsgTimeout = 0;
}
if (_networkContext != null && _networkContext.Stream != null) if (_networkContext != null && _networkContext.Stream != null)
{ {
if (_networkContext.Stream.CanWrite) if (_networkContext.Stream.CanWrite)

View File

@ -29,7 +29,7 @@ namespace OpenSim
{ {
public class VersionInfo public class VersionInfo
{ {
private const string VERSION_NUMBER = "0.7.6"; private const string VERSION_NUMBER = "0.8.0";
private const Flavour VERSION_FLAVOUR = Flavour.Dev; private const Flavour VERSION_FLAVOUR = Flavour.Dev;
public enum Flavour public enum Flavour

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -32,6 +32,7 @@ using log4net;
using Nini.Config; using Nini.Config;
using Mono.Addins; using Mono.Addins;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -94,6 +95,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
public virtual void RegionLoaded(Scene scene) public virtual void RegionLoaded(Scene scene)
{ {
if (!m_enabled)
return;
ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface<ISimulatorFeaturesModule>();
if (featuresModule != null)
featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
} }
public virtual void RemoveRegion(Scene scene) public virtual void RemoveRegion(Scene scene)
@ -351,5 +360,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
return true; return true;
} }
#region SimulatorFeaturesRequest
static OSDInteger m_SayRange, m_WhisperRange, m_ShoutRange;
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
{
OSD extras = new OSDMap();
if (features.ContainsKey("OpenSimExtras"))
extras = features["OpenSimExtras"];
else
features["OpenSimExtras"] = extras;
if (m_SayRange == null)
{
// Do this only once
m_SayRange = new OSDInteger(m_saydistance);
m_WhisperRange = new OSDInteger(m_whisperdistance);
m_ShoutRange = new OSDInteger(m_shoutdistance);
}
((OSDMap)extras)["say-range"] = m_SayRange;
((OSDMap)extras)["whisper-range"] = m_WhisperRange;
((OSDMap)extras)["shout-range"] = m_ShoutRange;
}
#endregion
} }
} }

View File

@ -30,7 +30,7 @@ using Mono.Addins;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]
[assembly: Addin("OpenSim.Region.CoreModules", "0.1")] [assembly: Addin("OpenSim.Region.CoreModules", "0.1")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -30,7 +30,7 @@ using Mono.Addins;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]
[assembly: Addin("OpenSim.Region.OptionalModules", "0.1")] [assembly: Addin("OpenSim.Region.OptionalModules", "0.1")]

View File

@ -44,6 +44,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
public bool SenseAsAgent { get; set; } public bool SenseAsAgent { get; set; }
public delegate void ChatToNPC(
string message, byte type, Vector3 fromPos, string fromName,
UUID fromAgentID, UUID ownerID, byte source, byte audible);
/// <summary>
/// Fired when the NPC receives a chat message.
/// </summary>
public event ChatToNPC OnChatToNPC;
/// <summary>
/// Fired when the NPC receives an instant message.
/// </summary>
public event Action<GridInstantMessage> OnInstantMessageToNPC;
private readonly string m_firstname; private readonly string m_firstname;
private readonly string m_lastname; private readonly string m_lastname;
private readonly Vector3 m_startPos; private readonly Vector3 m_startPos;
@ -614,17 +628,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC
string message, byte type, Vector3 fromPos, string fromName, string message, byte type, Vector3 fromPos, string fromName,
UUID fromAgentID, UUID ownerID, byte source, byte audible) UUID fromAgentID, UUID ownerID, byte source, byte audible)
{ {
} ChatToNPC ctn = OnChatToNPC;
public virtual void SendChatMessage( if (ctn != null)
byte[] message, byte type, Vector3 fromPos, string fromName, ctn(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible);
UUID fromAgentID, UUID ownerID, byte source, byte audible)
{
} }
public void SendInstantMessage(GridInstantMessage im) public void SendInstantMessage(GridInstantMessage im)
{ {
Action<GridInstantMessage> oimtn = OnInstantMessageToNPC;
if (oimtn != null)
oimtn(im);
} }
public void SendGenericMessage(string method, UUID invoice, List<string> message) public void SendGenericMessage(string method, UUID invoice, List<string> message)

View File

@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -53,6 +53,7 @@ namespace OpenSim.Server.Handlers.Login
private ILoginService m_LocalService; private ILoginService m_LocalService;
private bool m_Proxy; private bool m_Proxy;
public LLLoginHandlers(ILoginService service, bool hasProxy) public LLLoginHandlers(ILoginService service, bool hasProxy)
{ {
@ -213,6 +214,61 @@ namespace OpenSim.Server.Handlers.Login
return FailedOSDResponse(); return FailedOSDResponse();
} }
public void HandleWebSocketLoginEvents(string path, WebSocketHttpServerHandler sock)
{
sock.MaxPayloadSize = 16384; //16 kb payload
sock.InitialMsgTimeout = 5000; //5 second first message to trigger at least one of these events
sock.NoDelay_TCP_Nagle = true;
sock.OnData += delegate(object sender, WebsocketDataEventArgs data) { sock.Close("fail"); };
sock.OnPing += delegate(object sender, PingEventArgs pingdata) { sock.Close("fail"); };
sock.OnPong += delegate(object sender, PongEventArgs pongdata) { sock.Close("fail"); };
sock.OnText += delegate(object sender, WebsocketTextEventArgs text)
{
OSD request = null;
try
{
request = OSDParser.DeserializeJson(text.Data);
if (!(request is OSDMap))
{
sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse()));
}
else
{
OSDMap req = request as OSDMap;
string first = req["firstname"].AsString();
string last = req["lastname"].AsString();
string passwd = req["passwd"].AsString();
string start = req["startlocation"].AsString();
string version = req["version"].AsString();
string channel = req["channel"].AsString();
string mac = req["mac"].AsString();
string id0 = req["id0"].AsString();
UUID scope = UUID.Zero;
IPEndPoint endPoint =
(sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint();
LoginResponse reply = null;
reply = m_LocalService.Login(first, last, passwd, start, scope, version,
channel, mac, id0, endPoint);
sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap()));
}
}
catch (Exception)
{
sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse()));
}
finally
{
sock.Close("success");
}
};
sock.HandshakeAndUpgrade();
}
private XmlRpcResponse FailedXMLRPCResponse() private XmlRpcResponse FailedXMLRPCResponse()
{ {
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();

View File

@ -98,6 +98,7 @@ namespace OpenSim.Server.Handlers.Login
server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
server.AddWebSocketHandler("/WebSocket/GridLogin", loginHandlers.HandleWebSocketLoginEvents);
} }
} }
} }

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyVersion("0.8.0.*")]