* Tried to make the sandbox/useraccount sim setup a bit simpler
* Removed some comments0.1-prestable
parent
cc666ce259
commit
761db20c5f
|
@ -73,7 +73,7 @@ namespace OpenSim
|
||||||
private EndPoint epSender;
|
private EndPoint epSender;
|
||||||
private AsyncCallback ReceivedData;
|
private AsyncCallback ReceivedData;
|
||||||
|
|
||||||
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
private System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
|
||||||
private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll";
|
private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll";
|
||||||
public string m_physicsEngine;
|
public string m_physicsEngine;
|
||||||
public bool m_sandbox = false;
|
public bool m_sandbox = false;
|
||||||
|
@ -176,40 +176,39 @@ namespace OpenSim
|
||||||
|
|
||||||
|
|
||||||
LoginServer loginServer = null;
|
LoginServer loginServer = null;
|
||||||
if (m_loginserver && m_sandbox)
|
LoginServer adminLoginServer = null;
|
||||||
|
|
||||||
|
bool sandBoxWithLoginServer = m_loginserver && m_sandbox;
|
||||||
|
if (sandBoxWithLoginServer)
|
||||||
{
|
{
|
||||||
loginServer = new LoginServer(gridServer, Cfg.IPListenAddr, Cfg.IPListenPort, this.user_accounts);
|
loginServer = new LoginServer(gridServer, Cfg.IPListenAddr, Cfg.IPListenPort, this.user_accounts);
|
||||||
loginServer.Startup();
|
loginServer.Startup();
|
||||||
|
|
||||||
}
|
if( user_accounts )
|
||||||
|
|
||||||
if ((m_loginserver) && (m_sandbox) && (user_accounts))
|
|
||||||
{
|
{
|
||||||
//sandbox mode with loginserver using accounts
|
//sandbox mode with loginserver using accounts
|
||||||
this.GridServers.UserServer = loginServer;
|
this.GridServers.UserServer = loginServer;
|
||||||
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, loginServer));
|
adminLoginServer = loginServer;
|
||||||
|
|
||||||
HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
|
HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
|
||||||
}
|
}
|
||||||
else if ((m_loginserver) && (m_sandbox))
|
|
||||||
{
|
|
||||||
//sandbox mode with loginserver not using accounts
|
|
||||||
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, null));
|
|
||||||
HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//not in sandbox mode so no loginserver, so we don't handle login attempts
|
//sandbox mode with loginserver not using accounts
|
||||||
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, null));
|
HttpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin", LocalWorld, adminLoginServer ));
|
||||||
|
|
||||||
m_console.WriteLine("Main.cs:Startup() - Starting HTTP server");
|
m_console.WriteLine("Main.cs:Startup() - Starting HTTP server");
|
||||||
HttpServer.Start();
|
HttpServer.Start();
|
||||||
|
|
||||||
MainServerListener();
|
MainServerListener();
|
||||||
|
|
||||||
timer1.Enabled = true;
|
m_heartbeatTimer.Enabled = true;
|
||||||
timer1.Interval = 100;
|
m_heartbeatTimer.Interval = 100;
|
||||||
timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick);
|
m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SimConfig LoadConfigDll(string dllName)
|
private SimConfig LoadConfigDll(string dllName)
|
||||||
|
@ -340,7 +339,7 @@ namespace OpenSim
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer1Tick(object sender, System.EventArgs e)
|
void Heartbeat(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
LocalWorld.Update();
|
LocalWorld.Update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
|
@ -83,15 +83,6 @@ namespace OpenSim.UserServer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Startup()
|
public void Startup()
|
||||||
{
|
|
||||||
this.InitializeLogin();
|
|
||||||
//Thread runLoginProxy = new Thread(new ThreadStart(RunLogin));
|
|
||||||
//runLoginProxy.IsBackground = true;
|
|
||||||
//runLoginProxy.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitializeLogin: initialize the login
|
|
||||||
private void InitializeLogin()
|
|
||||||
{
|
{
|
||||||
this._needPasswd = false;
|
this._needPasswd = false;
|
||||||
//read in default response string
|
//read in default response string
|
||||||
|
@ -99,13 +90,10 @@ namespace OpenSim.UserServer
|
||||||
string lines;
|
string lines;
|
||||||
SR = File.OpenText("new-login.dat");
|
SR = File.OpenText("new-login.dat");
|
||||||
|
|
||||||
//lines=SR.ReadLine();
|
|
||||||
|
|
||||||
while (!SR.EndOfStream)
|
while (!SR.EndOfStream)
|
||||||
{
|
{
|
||||||
lines = SR.ReadLine();
|
lines = SR.ReadLine();
|
||||||
_defaultResponse += lines;
|
_defaultResponse += lines;
|
||||||
//lines = SR.ReadLine();
|
|
||||||
}
|
}
|
||||||
SR.Close();
|
SR.Close();
|
||||||
this._mpasswd = EncodePassword("testpass");
|
this._mpasswd = EncodePassword("testpass");
|
||||||
|
@ -113,118 +101,8 @@ namespace OpenSim.UserServer
|
||||||
userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr);
|
userManager = new LocalUserProfileManager(this.m_gridServer, m_simPort, m_simAddr);
|
||||||
userManager.InitUserProfiles();
|
userManager.InitUserProfiles();
|
||||||
userManager.SetKeys("", "", "", "Welcome to OpenSim");
|
userManager.SetKeys("", "", "", "Welcome to OpenSim");
|
||||||
|
|
||||||
//loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
|
||||||
// loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
|
|
||||||
//loginServer.Listen(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private void RunLogin()
|
|
||||||
{
|
|
||||||
Console.WriteLine("Starting Login Server");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
for (; ; )
|
|
||||||
{
|
|
||||||
Socket client = loginServer.Accept();
|
|
||||||
IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
|
|
||||||
|
|
||||||
|
|
||||||
NetworkStream networkStream = new NetworkStream(client);
|
|
||||||
StreamReader networkReader = new StreamReader(networkStream);
|
|
||||||
StreamWriter networkWriter = new StreamWriter(networkStream);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoginRequest(networkReader, networkWriter);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
networkWriter.Close();
|
|
||||||
networkReader.Close();
|
|
||||||
networkStream.Close();
|
|
||||||
|
|
||||||
client.Close();
|
|
||||||
|
|
||||||
// send any packets queued for injection
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.Message);
|
|
||||||
Console.WriteLine(e.StackTrace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProxyLogin: proxy a login request
|
|
||||||
private void LoginRequest(StreamReader reader, StreamWriter writer)
|
|
||||||
{
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
string line;
|
|
||||||
int contentLength = 0;
|
|
||||||
// read HTTP header
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// read one line of the header
|
|
||||||
line = reader.ReadLine();
|
|
||||||
|
|
||||||
// check for premature EOF
|
|
||||||
if (line == null)
|
|
||||||
throw new Exception("EOF in client HTTP header");
|
|
||||||
|
|
||||||
// look for Content-Length
|
|
||||||
Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line);
|
|
||||||
if (match.Success)
|
|
||||||
contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString());
|
|
||||||
} while (line != "");
|
|
||||||
|
|
||||||
// read the HTTP body into a buffer
|
|
||||||
char[] content = new char[contentLength];
|
|
||||||
reader.Read(content, 0, contentLength);
|
|
||||||
|
|
||||||
if (this.userAccounts)
|
|
||||||
{
|
|
||||||
//ask the UserProfile Manager to process the request
|
|
||||||
string reply = this.userManager.ParseXMLRPC(new String(content));
|
|
||||||
// forward the XML-RPC response to the client
|
|
||||||
writer.WriteLine("HTTP/1.0 200 OK");
|
|
||||||
writer.WriteLine("Content-type: text/xml");
|
|
||||||
writer.WriteLine();
|
|
||||||
writer.WriteLine(reply);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//handle ourselves
|
|
||||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
|
|
||||||
if (request.MethodName == "login_to_simulator")
|
|
||||||
{
|
|
||||||
this.ProcessXmlRequest(request, writer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
|
|
||||||
Hashtable PresenceErrorRespData = new Hashtable();
|
|
||||||
PresenceErrorRespData["reason"] = "XmlRequest"; ;
|
|
||||||
PresenceErrorRespData["message"] = "Unknown Rpc request";
|
|
||||||
PresenceErrorRespData["login"] = "false";
|
|
||||||
PresenceErrorResp.Value = PresenceErrorRespData;
|
|
||||||
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
|
|
||||||
writer.WriteLine("HTTP/1.0 200 OK");
|
|
||||||
writer.WriteLine("Content-type: text/xml");
|
|
||||||
writer.WriteLine();
|
|
||||||
writer.WriteLine(reply);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer)
|
|
||||||
|
|
||||||
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
Console.WriteLine("login attempt");
|
Console.WriteLine("login attempt");
|
||||||
|
@ -267,19 +145,6 @@ namespace OpenSim.UserServer
|
||||||
|
|
||||||
if (!Authenticate(first, last, passwd))
|
if (!Authenticate(first, last, passwd))
|
||||||
{
|
{
|
||||||
/* XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
|
|
||||||
Hashtable PresenceErrorRespData = new Hashtable();
|
|
||||||
PresenceErrorRespData["reason"] = "key"; ;
|
|
||||||
PresenceErrorRespData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
|
|
||||||
PresenceErrorRespData["login"] = "false";
|
|
||||||
PresenceErrorResp.Value = PresenceErrorRespData;
|
|
||||||
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
|
|
||||||
writer.WriteLine("HTTP/1.0 200 OK");
|
|
||||||
writer.WriteLine("Content-type: text/xml");
|
|
||||||
writer.WriteLine();
|
|
||||||
writer.WriteLine(reply);
|
|
||||||
return false;*/
|
|
||||||
|
|
||||||
Hashtable loginError = new Hashtable();
|
Hashtable loginError = new Hashtable();
|
||||||
loginError["reason"] = "key"; ;
|
loginError["reason"] = "key"; ;
|
||||||
loginError["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
|
loginError["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
|
||||||
|
@ -356,15 +221,6 @@ namespace OpenSim.UserServer
|
||||||
((LocalGridBase)m_gridServer).AddNewSession(_login);
|
((LocalGridBase)m_gridServer).AddNewSession(_login);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* // forward the XML-RPC response to the client
|
|
||||||
writer.WriteLine("HTTP/1.0 200 OK");
|
|
||||||
writer.WriteLine("Content-type: text/xml");
|
|
||||||
writer.WriteLine();
|
|
||||||
|
|
||||||
XmlTextWriter responseWriter = new XmlTextWriter(writer);
|
|
||||||
XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
|
|
||||||
responseWriter.Close();*/
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +301,6 @@ namespace OpenSim.UserServer
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
27
OpenSim.sln
27
OpenSim.sln
|
@ -35,33 +35,6 @@ Global
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectDependencies) = postSolution
|
|
||||||
({8BB20F0A-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({8BB20F0A-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({83C87BE6-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({83C87BE6-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({66591469-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({B55C0B5D-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({B55C0B5D-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({E1B79ECF-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({E1B79ECF-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({21BFC8E2-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({63A05FE9-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
|
|
||||||
({4F874463-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
|
|
||||||
({438A9556-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({438A9556-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({438A9556-0000-0000-0000-000000000000}).7 = ({8BE16150-0000-0000-0000-000000000000})
|
|
||||||
({438A9556-0000-0000-0000-000000000000}).8 = ({632E1BFD-0000-0000-0000-000000000000})
|
|
||||||
({632E1BFD-0000-0000-0000-000000000000}).5 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({632E1BFD-0000-0000-0000-000000000000}).6 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({632E1BFD-0000-0000-0000-000000000000}).7 = ({8BE16150-0000-0000-0000-000000000000})
|
|
||||||
({632E1BFD-0000-0000-0000-000000000000}).8 = ({8BB20F0A-0000-0000-0000-000000000000})
|
|
||||||
({8BE16150-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({8BE16150-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({546099CD-0000-0000-0000-000000000000}).4 = ({8ACA2445-0000-0000-0000-000000000000})
|
|
||||||
({546099CD-0000-0000-0000-000000000000}).5 = ({A7CD0630-0000-0000-0000-000000000000})
|
|
||||||
({988F0AC4-0000-0000-0000-000000000000}).3 = ({8BE16150-0000-0000-0000-000000000000})
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{8BB20F0A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
|
Loading…
Reference in New Issue