diff options
author | Johan Berntsson | 2008-03-24 01:37:00 +0000 |
---|---|---|
committer | Johan Berntsson | 2008-03-24 01:37:00 +0000 |
commit | 39f340e6875c55927fc9dbeb51af2357c7d28c04 (patch) | |
tree | ec7bd54fd3f15abca441faa500e4275559779818 /OpenSim | |
parent | Added a plugin loader in GridServer (diff) | |
download | opensim-SC_OLD-39f340e6875c55927fc9dbeb51af2357c7d28c04.zip opensim-SC_OLD-39f340e6875c55927fc9dbeb51af2357c7d28c04.tar.gz opensim-SC_OLD-39f340e6875c55927fc9dbeb51af2357c7d28c04.tar.bz2 opensim-SC_OLD-39f340e6875c55927fc9dbeb51af2357c7d28c04.tar.xz |
XmlRpcCommand refactoring
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Util.cs | 13 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/GridServerBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 37 |
3 files changed, 16 insertions, 36 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 6c95c88..a184f89 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -35,6 +35,7 @@ using System.Security.Cryptography; | |||
35 | using System.Text; | 35 | using System.Text; |
36 | using libsecondlife; | 36 | using libsecondlife; |
37 | using Nini.Config; | 37 | using Nini.Config; |
38 | using Nwc.XmlRpc; | ||
38 | 39 | ||
39 | using System.Runtime.Serialization; | 40 | using System.Runtime.Serialization; |
40 | using System.Runtime.Serialization.Formatters.Binary; | 41 | using System.Runtime.Serialization.Formatters.Binary; |
@@ -605,5 +606,17 @@ namespace OpenSim.Framework | |||
605 | } | 606 | } |
606 | return returnstring; | 607 | return returnstring; |
607 | } | 608 | } |
609 | |||
610 | static public XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) | ||
611 | { | ||
612 | return SendXmlRpcCommand(url, methodName, args); | ||
613 | } | ||
614 | |||
615 | static public XmlRpcResponse SendXmlRpcCommand(string url, string methodName, object[] args) | ||
616 | { | ||
617 | XmlRpcRequest client = new XmlRpcRequest(methodName, args); | ||
618 | return client.Send(url, 6000); | ||
619 | } | ||
620 | |||
608 | } | 621 | } |
609 | } | 622 | } |
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index c29924b..acefe3f 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Grid.GridServer | |||
48 | protected BaseHttpServer httpServer; | 48 | protected BaseHttpServer httpServer; |
49 | protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); | 49 | protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); |
50 | 50 | ||
51 | public BaseHttpServer | 51 | public BaseHttpServer HttpServer |
52 | { | 52 | { |
53 | get { return httpServer; } | 53 | get { return httpServer; } |
54 | } | 54 | } |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index aa5a432..35f146d 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -461,7 +461,7 @@ namespace OpenSim | |||
461 | { | 461 | { |
462 | // set proxy url to RegionInfo | 462 | // set proxy url to RegionInfo |
463 | regionInfo.proxyUrl = proxyUrl; | 463 | regionInfo.proxyUrl = proxyUrl; |
464 | ProxyCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | 464 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); |
465 | } | 465 | } |
466 | 466 | ||
467 | UDPServer udpServer; | 467 | UDPServer udpServer; |
@@ -618,7 +618,7 @@ namespace OpenSim | |||
618 | /// </summary> | 618 | /// </summary> |
619 | public virtual void Shutdown() | 619 | public virtual void Shutdown() |
620 | { | 620 | { |
621 | ProxyCommand(proxyUrl, "Stop"); | 621 | Util.XmlRpcCommand(proxyUrl, "Stop"); |
622 | 622 | ||
623 | if (m_startupCommandsFile != String.Empty) | 623 | if (m_startupCommandsFile != String.Empty) |
624 | { | 624 | { |
@@ -1200,39 +1200,6 @@ namespace OpenSim | |||
1200 | 1200 | ||
1201 | #endregion | 1201 | #endregion |
1202 | 1202 | ||
1203 | // TODO: remove me!! (almost same as XmlRpcCommand) | ||
1204 | public object ProxyCommand(string url, string methodName, params object[] args) | ||
1205 | { | ||
1206 | if(proxyUrl.Length==0) return null; | ||
1207 | return SendXmlRpcCommand(url, methodName, args); | ||
1208 | } | ||
1209 | |||
1210 | public object XmlRpcCommand(uint port, string methodName, params object[] args) | ||
1211 | { | ||
1212 | return SendXmlRpcCommand("http://localhost:"+port, methodName, args); | ||
1213 | } | ||
1214 | |||
1215 | public object XmlRpcCommand(string url, string methodName, params object[] args) | ||
1216 | { | ||
1217 | return SendXmlRpcCommand(url, methodName, args); | ||
1218 | } | ||
1219 | |||
1220 | private object SendXmlRpcCommand(string url, string methodName, object[] args) | ||
1221 | { | ||
1222 | try { | ||
1223 | //MainLog.Instance.Verbose("XMLRPC", "Sending command {0} to {1}", methodName, url); | ||
1224 | XmlRpcRequest client = new XmlRpcRequest(methodName, args); | ||
1225 | //MainLog.Instance.Verbose("XMLRPC", client.ToString()); | ||
1226 | XmlRpcResponse response = client.Send(url, 6000); | ||
1227 | if(!response.IsFault) return response.Value; | ||
1228 | } | ||
1229 | catch(Exception e) | ||
1230 | { | ||
1231 | m_log.ErrorFormat("XMLRPC Failed to send command {0} to {1}: {2}", methodName, url, e.Message); | ||
1232 | } | ||
1233 | return null; | ||
1234 | } | ||
1235 | |||
1236 | /// <summary> | 1203 | /// <summary> |
1237 | /// Get the start time and up time of Region server | 1204 | /// Get the start time and up time of Region server |
1238 | /// </summary> | 1205 | /// </summary> |