Now starts up a laggy (to be fixed) TCP server in grid mode and sends a banner

NEED THREAD POOLS!!! DO NOT LET ME GET AWAY WITH BEING LAZY PEOPLE!
0.1-prestable
gareth 2007-04-22 05:40:00 +00:00
parent b8c742b932
commit b0dfd5602a
2 changed files with 18 additions and 3 deletions

View File

@ -82,9 +82,11 @@ namespace OpenSim
public string m_physicsEngine; public string m_physicsEngine;
public bool m_sandbox = false; public bool m_sandbox = false;
public bool m_loginserver; public bool m_loginserver;
public OpenGridProtocolServer OGSServer;
public bool user_accounts = false; public bool user_accounts = false;
public bool gridLocalAsset = false; public bool gridLocalAsset = false;
protected ConsoleBase m_console; protected ConsoleBase m_console;
public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine) public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine)
@ -203,6 +205,9 @@ namespace OpenSim
if (gridServer.GetName() == "Remote") if (gridServer.GetName() == "Remote")
{ {
// should startup the OGS protocol server here
OGSServer = new OpenGridProtocolServer(8500);
// we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server
httpServer.AddXmlRPCHandler("expect_user", httpServer.AddXmlRPCHandler("expect_user",
delegate(XmlRpcRequest request) delegate(XmlRpcRequest request)
@ -294,6 +299,11 @@ namespace OpenSim
m_console.WriteLine("Main.cs:Startup() - Starting HTTP server"); m_console.WriteLine("Main.cs:Startup() - Starting HTTP server");
httpServer.Start(); httpServer.Start();
if(gridServer.GetName() == "Remote") {
m_console.WriteLine("Main.cs:Startup() - Starting up OGS protocol server");
OGSServer.Start();
}
MainServerListener(); MainServerListener();
m_heartbeatTimer.Enabled = true; m_heartbeatTimer.Enabled = true;

View File

@ -33,10 +33,12 @@ namespace OpenSim.Servers
private void DoWork() { private void DoWork() {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client");
this.WriteLine("OpenSim 0.1, running OGS protocol 1.0");
} }
private void WriteLine(string theline) { private void WriteLine(string theline) {
theline+="\n";
byte[] thelinebuffer = System.Text.Encoding.ASCII.GetBytes(theline.ToCharArray()); byte[] thelinebuffer = System.Text.Encoding.ASCII.GetBytes(theline.ToCharArray());
m_socketHandle.Send(thelinebuffer,theline.Length,0); m_socketHandle.Send(thelinebuffer,theline.Length,0);
} }
@ -51,6 +53,7 @@ namespace OpenSim.Servers
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: Start() - Opening server socket"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: Start() - Opening server socket");
m_clients = new ArrayList();
m_workerThread = new Thread(new ThreadStart(StartServerSocket)); m_workerThread = new Thread(new ThreadStart(StartServerSocket));
m_workerThread.IsBackground = true; m_workerThread.IsBackground = true;
m_workerThread.Start(); m_workerThread.Start();
@ -72,9 +75,11 @@ namespace OpenSim.Servers
while (true) while (true)
{ {
sockethandle = m_listenerSocket.Accept(); sockethandle = m_listenerSocket.Accept();
lock(m_clients.SyncRoot) {
m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle)); m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle));
} }
} }
}
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.Message); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.Message);