aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs
diff options
context:
space:
mode:
authorTedd Hansen2008-01-12 01:14:31 +0000
committerTedd Hansen2008-01-12 01:14:31 +0000
commite7dbaad04f1599965cf8ad709828a17fbd6f8a3a (patch)
tree7187520c6a30055bc005d11d2b1666e311735504 /OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs
parentScriptServer communication protocol (v1), primitive RPC-like TCP client/server (diff)
downloadopensim-SC-e7dbaad04f1599965cf8ad709828a17fbd6f8a3a.zip
opensim-SC-e7dbaad04f1599965cf8ad709828a17fbd6f8a3a.tar.gz
opensim-SC-e7dbaad04f1599965cf8ad709828a17fbd6f8a3a.tar.bz2
opensim-SC-e7dbaad04f1599965cf8ad709828a17fbd6f8a3a.tar.xz
New ScriptServer protocol successfully implemented.
Still needs hooking up for all commands in both ends, separation of local and remote LSL-commands, etc.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs36
1 files changed, 31 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs
index 1b37378..39f2695 100644
--- a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs
@@ -30,6 +30,7 @@ using System;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.ScriptEngine.Common; 32using OpenSim.Region.ScriptEngine.Common;
33using OpenSim.Region.ScriptEngine.Common.TRPC;
33 34
34namespace OpenSim.Region.ScriptEngine.RemoteServer 35namespace OpenSim.Region.ScriptEngine.RemoteServer
35{ 36{
@@ -41,14 +42,23 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
41 { 42 {
42 43
43 System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>(); 44 System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>();
45 TCPClient m_TCPClient;
46 TRPC_Remote RPC;
47 int myScriptServerID;
44 48
49 string remoteHost = "127.0.0.1";
50 int remotePort = 8010;
45 51
46 private ScriptEngine myScriptEngine; 52 private ScriptEngine myScriptEngine;
47 public EventManager(ScriptEngine _ScriptEngine) 53 public EventManager(ScriptEngine _ScriptEngine)
48 { 54 {
49 myScriptEngine = _ScriptEngine; 55 myScriptEngine = _ScriptEngine;
50 56
51 57 m_TCPClient = new TCPClient();
58 RPC = new TRPC_Remote(m_TCPClient);
59 RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
60 myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort);
61
52 myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); 62 myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events");
53 //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 63 //myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
54 myScriptEngine.World.EventManager.OnRezScript += OnRezScript; 64 myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
@@ -57,16 +67,32 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
57 67
58 } 68 }
59 69
70 void RPC_ReceiveCommand(int ID, string Command, params object[] p)
71 {
72 myScriptEngine.Log.Notice("REMOTESERVER", "Received command: '" + Command + "'");
73 if (p != null)
74 {
75 for (int i = 0; i < p.Length; i++)
76 {
77 myScriptEngine.Log.Notice("REMOTESERVER", "Param " + i + ": " + p[i].ToString());
78 }
79 }
80
81 }
82
60 83
61 public void OnRezScript(uint localID, LLUUID itemID, string script) 84 public void OnRezScript(uint localID, LLUUID itemID, string script)
62 { 85 {
63 // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID 86 // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID
64 myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)"); 87 myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)");
65 88
89 // Temp for now: We have one connection only - this is hardcoded in myScriptServerID
90 RPC.SendCommand(myScriptServerID, "OnRezScript", script);
66 91
67 ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); 92 //ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234);
68 remoteScript.Add(localID, obj); 93 //remoteScript.Add(localID, obj);
69 remoteScript[localID].Events().OnRezScript(localID, itemID, script); 94 //remoteScript[localID].Events().OnRezScript(localID, itemID, script);
95
70 96
71 } 97 }
72 98