* Added graceful remote script server connection error handling

* Removed a friends module test that I had.
afrisby
Teravus Ovares 2007-12-30 23:56:29 +00:00
parent 57a1132585
commit 373d801c40
3 changed files with 299 additions and 47 deletions

View File

@ -56,8 +56,8 @@ namespace OpenSim.Region.Environment.Modules
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
FormFriendship(client,new Guid("c43a67ab-b196-4d62-936c-b40369547dee")); //FormFriendship(client,new Guid("c43a67ab-b196-4d62-936c-b40369547dee"));
FormFriendship(client, new Guid("0a2f777b-f44c-4662-8b22-c90ae038a3e6")); //FormFriendship(client, new Guid("0a2f777b-f44c-4662-8b22-c90ae038a3e6"));
} }
public void PostInitialise() public void PostInitialise()

View File

@ -63,172 +63,410 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
// WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID
OpenSim.Grid.ScriptServer.RemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); OpenSim.Grid.ScriptServer.RemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234);
remoteScript.Add(localID, obj); remoteScript.Add(localID, obj);
remoteScript[localID].ScriptEngine.m_EventManager.OnRezScript(localID, itemID, script); try
{
remoteScript[localID].ScriptEngine.m_EventManager.OnRezScript(localID, itemID, script);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.touch_start(localID, offsetPos, remoteClient); try
{
remoteScript[localID].ScriptEngine.m_EventManager.touch_start(localID, offsetPos, remoteClient);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void OnRemoveScript(uint localID, LLUUID itemID) public void OnRemoveScript(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.OnRemoveScript(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.OnRemoveScript(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void state_exit(uint localID, LLUUID itemID) public void state_exit(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.state_exit(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.state_exit(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void touch(uint localID, LLUUID itemID) public void touch(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.touch(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.touch(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void touch_end(uint localID, LLUUID itemID) public void touch_end(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.touch_end(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.touch_end(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void collision_start(uint localID, LLUUID itemID) public void collision_start(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.collision_start(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.collision_start(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void collision(uint localID, LLUUID itemID) public void collision(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.collision(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.collision(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void collision_end(uint localID, LLUUID itemID) public void collision_end(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.collision_end(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.collision_end(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void land_collision_start(uint localID, LLUUID itemID) public void land_collision_start(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.land_collision_start(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.land_collision_start(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void land_collision(uint localID, LLUUID itemID) public void land_collision(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.land_collision(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.land_collision(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void land_collision_end(uint localID, LLUUID itemID) public void land_collision_end(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.land_collision_end(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.land_collision_end(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void timer(uint localID, LLUUID itemID) public void timer(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.timer(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.timer(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void listen(uint localID, LLUUID itemID) public void listen(uint localID, LLUUID itemID)
{ {
try
{
remoteScript[localID].ScriptEngine.m_EventManager.listen(localID, itemID); remoteScript[localID].ScriptEngine.m_EventManager.listen(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void on_rez(uint localID, LLUUID itemID) public void on_rez(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.on_rez(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.on_rez(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void sensor(uint localID, LLUUID itemID) public void sensor(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.sensor(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.sensor(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void no_sensor(uint localID, LLUUID itemID) public void no_sensor(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.no_sensor(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.no_sensor(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void control(uint localID, LLUUID itemID) public void control(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.control(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.control(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void money(uint localID, LLUUID itemID) public void money(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.money(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.money(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void email(uint localID, LLUUID itemID) public void email(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.email(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.email(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void at_target(uint localID, LLUUID itemID) public void at_target(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.at_target(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.at_target(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void not_at_target(uint localID, LLUUID itemID) public void not_at_target(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.not_at_target(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.not_at_target(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void at_rot_target(uint localID, LLUUID itemID) public void at_rot_target(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.at_rot_target(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.at_rot_target(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void not_at_rot_target(uint localID, LLUUID itemID) public void not_at_rot_target(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.not_at_rot_target(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.not_at_rot_target(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void run_time_permissions(uint localID, LLUUID itemID) public void run_time_permissions(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.run_time_permissions(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.run_time_permissions(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void changed(uint localID, LLUUID itemID) public void changed(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.changed(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.changed(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void attach(uint localID, LLUUID itemID) public void attach(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.attach(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.attach(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void dataserver(uint localID, LLUUID itemID) public void dataserver(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.dataserver(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.dataserver(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void link_message(uint localID, LLUUID itemID) public void link_message(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.link_message(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.link_message(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void moving_start(uint localID, LLUUID itemID) public void moving_start(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.moving_start(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.moving_start(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void moving_end(uint localID, LLUUID itemID) public void moving_end(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.moving_end(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.moving_end(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void object_rez(uint localID, LLUUID itemID) public void object_rez(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.object_rez(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.object_rez(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void remote_data(uint localID, LLUUID itemID) public void remote_data(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.remote_data(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.remote_data(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
public void http_response(uint localID, LLUUID itemID) public void http_response(uint localID, LLUUID itemID)
{ {
remoteScript[localID].ScriptEngine.m_EventManager.http_response(localID, itemID); try
{
remoteScript[localID].ScriptEngine.m_EventManager.http_response(localID, itemID);
}
catch (System.NullReferenceException)
{
OpenSim.Framework.Console.MainLog.Instance.Error("SCRIPTS", "Error Connecting to Remote Script Server. Is it running?");
}
} }
} }

View File

@ -17,21 +17,35 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
// Create a channel for communicating w/ the remote object // Create a channel for communicating w/ the remote object
// Notice no port is specified on the client // Notice no port is specified on the client
TcpChannel chan = new TcpChannel(); TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan, true); try
// Create an instance of the remote object
OpenSim.Grid.ScriptServer.RemotingObject obj = (OpenSim.Grid.ScriptServer.RemotingObject)Activator.GetObject(
typeof(OpenSim.Grid.ScriptServer.RemotingObject),
"tcp://" + hostname + ":" + port + "/DotNetEngine");
// Use the object
if (obj.Equals(null))
{ {
System.Console.WriteLine("Error: unable to locate server"); ChannelServices.RegisterChannel(chan, true);
} }
else catch (System.Runtime.Remoting.RemotingException)
{ {
return obj; System.Console.WriteLine("Error: tcp already registered, RemoteServer.cs in OpenSim.Region.ScriptEngine.RemoteServer line 24");
}
try
{
// Create an instance of the remote object
OpenSim.Grid.ScriptServer.RemotingObject obj = (OpenSim.Grid.ScriptServer.RemotingObject)Activator.GetObject(
typeof(OpenSim.Grid.ScriptServer.RemotingObject),
"tcp://" + hostname + ":" + port + "/DotNetEngine");
// Use the object
if (obj.Equals(null))
{
System.Console.WriteLine("Error: unable to locate server");
}
else
{
return obj;
}
}
catch (System.Net.Sockets.SocketException)
{
System.Console.WriteLine("Error: unable to connect to server");
} }
return null; return null;