aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs71
1 files changed, 35 insertions, 36 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 1101851..20555e4 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -41,7 +41,6 @@ using OpenMetaverse;
41using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
42 42
43using OpenSim.Framework; 43using OpenSim.Framework;
44using OpenSim.Framework.Communications;
45using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
47 46
@@ -168,8 +167,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
168 m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name); 167 m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name);
169 168
170 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); 169 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
171 if ((m_groupsServerURI == null) || 170 if (string.IsNullOrEmpty(m_groupsServerURI))
172 (m_groupsServerURI == string.Empty))
173 { 171 {
174 m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); 172 m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]");
175 m_connectorEnabled = false; 173 m_connectorEnabled = false;
@@ -354,7 +352,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
354 { 352 {
355 param["GroupID"] = GroupID.ToString(); 353 param["GroupID"] = GroupID.ToString();
356 } 354 }
357 if ((GroupName != null) && (GroupName != string.Empty)) 355 if (!string.IsNullOrEmpty(GroupName))
358 { 356 {
359 param["Name"] = GroupName.ToString(); 357 param["Name"] = GroupName.ToString();
360 } 358 }
@@ -1013,7 +1011,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1013 Hashtable respData = (Hashtable)resp.Value; 1011 Hashtable respData = (Hashtable)resp.Value;
1014 if (respData.Contains("error") && !respData.Contains("succeed")) 1012 if (respData.Contains("error") && !respData.Contains("succeed"))
1015 { 1013 {
1016 LogRespDataToConsoleError(respData); 1014 LogRespDataToConsoleError(requestingAgentID, function, param, respData);
1017 } 1015 }
1018 1016
1019 return respData; 1017 return respData;
@@ -1041,20 +1039,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1041 return error; 1039 return error;
1042 } 1040 }
1043 1041
1044 private void LogRespDataToConsoleError(Hashtable respData) 1042 private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData)
1045 { 1043 {
1046 m_log.Error("[XMLRPC-GROUPS-CONNECTOR]: Error:"); 1044 m_log.ErrorFormat(
1047 1045 "[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}",
1048 foreach (string key in respData.Keys) 1046 function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData));
1049 {
1050 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Key: {0}", key);
1051
1052 string[] lines = respData[key].ToString().Split(new char[] { '\n' });
1053 foreach (string line in lines)
1054 {
1055 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
1056 }
1057 }
1058 } 1047 }
1059 1048
1060 /// <summary> 1049 /// <summary>
@@ -1146,28 +1135,38 @@ namespace Nwc.XmlRpc
1146 request.AllowWriteStreamBuffering = true; 1135 request.AllowWriteStreamBuffering = true;
1147 request.KeepAlive = !_disableKeepAlive; 1136 request.KeepAlive = !_disableKeepAlive;
1148 1137
1149 Stream stream = request.GetRequestStream(); 1138 using (Stream stream = request.GetRequestStream())
1150 XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII);
1151 _serializer.Serialize(xml, this);
1152 xml.Flush();
1153 xml.Close();
1154
1155 HttpWebResponse response = (HttpWebResponse)request.GetResponse();
1156 StreamReader input = new StreamReader(response.GetResponseStream());
1157
1158 string inputXml = input.ReadToEnd();
1159 XmlRpcResponse resp;
1160 try
1161 { 1139 {
1162 resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); 1140 using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII))
1141 {
1142 _serializer.Serialize(xml, this);
1143 xml.Flush();
1144 }
1163 } 1145 }
1164 catch (Exception e) 1146
1147 XmlRpcResponse resp;
1148
1149 using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
1165 { 1150 {
1166 RequestResponse = inputXml; 1151 using (Stream s = response.GetResponseStream())
1167 throw e; 1152 {
1153 using (StreamReader input = new StreamReader(s))
1154 {
1155 string inputXml = input.ReadToEnd();
1156
1157 try
1158 {
1159 resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml);
1160 }
1161 catch (Exception e)
1162 {
1163 RequestResponse = inputXml;
1164 throw e;
1165 }
1166 }
1167 }
1168 } 1168 }
1169 input.Close(); 1169
1170 response.Close();
1171 return resp; 1170 return resp;
1172 } 1171 }
1173 } 1172 }