aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHomer Horwitz2008-11-03 19:13:42 +0000
committerHomer Horwitz2008-11-03 19:13:42 +0000
commita64d6eccd06abf43c142296662e8e65f8886cf9b (patch)
treeb9add796fa48380ccc22f00f79f299a2fee576e4
parent* Pull client throttle multipler setting out of config source. Not an adjust... (diff)
downloadopensim-SC-a64d6eccd06abf43c142296662e8e65f8886cf9b.zip
opensim-SC-a64d6eccd06abf43c142296662e8e65f8886cf9b.tar.gz
opensim-SC-a64d6eccd06abf43c142296662e8e65f8886cf9b.tar.bz2
opensim-SC-a64d6eccd06abf43c142296662e8e65f8886cf9b.tar.xz
Add a bit more error-checking to GetFriendRegionInfos.
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs37
1 files changed, 24 insertions, 13 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index ba37e61..3879910 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -739,19 +739,23 @@ namespace OpenSim.Region.Communications.OGS1
739 map["uuids"] = list; 739 map["uuids"] = list;
740 740
741 map["recv_key"] = m_parent.NetworkServersInfo.UserRecvKey; 741 map["recv_key"] = m_parent.NetworkServersInfo.UserRecvKey;
742 map["send_key"] = m_parent.NetworkServersInfo.UserRecvKey; 742 map["send_key"] = m_parent.NetworkServersInfo.UserSendKey;
743 743
744 parameters.Add(map); 744 parameters.Add(map);
745 745
746 try { 746 try {
747 XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters); 747 XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters);
748 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.MessagingURL, 8000); 748 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.MessagingURL, 8000);
749 Hashtable respData = (Hashtable) resp.Value; 749 Hashtable respData = resp != null ? (Hashtable) resp.Value : null;
750 750
751 if (respData.ContainsKey("faultMessage")) 751 if (respData == null || respData.ContainsKey("faultMessage"))
752 {
753 m_log.WarnFormat("[OGS1 USER SERVICES]: Contacting MessagingServer about user-regions resulted in error: {0}",
754 respData == null ? "<unknown error>" : respData["faultMessage"]);
755 }
756 else if(!respData.ContainsKey("count"))
752 { 757 {
753 m_log.WarnFormat("[OGS1 USER SERVICES]: Contacting MessageServer about user-regions resulted in error: {0}", 758 m_log.WarnFormat("[OGS1 USER SERVICES]: Wrong format in response for MessagingServer request get_presence_info_bulk: missing 'count' field");
754 respData["faultMessage"]);
755 } 759 }
756 else 760 else
757 { 761 {
@@ -759,14 +763,21 @@ namespace OpenSim.Region.Communications.OGS1
759 m_log.DebugFormat("[OGS1 USER SERVICES]: Request returned {0} results.", count); 763 m_log.DebugFormat("[OGS1 USER SERVICES]: Request returned {0} results.", count);
760 for (int i = 0; i < count; ++i) 764 for (int i = 0; i < count; ++i)
761 { 765 {
762 UUID uuid; 766 if(respData.ContainsKey("uuid_" + i) && respData.ContainsKey("isOnline_" + i) && respData.ContainsKey("regionHandle_" + i))
763 if (UUID.TryParse((string)respData["uuid_" + i], out uuid)) 767 {
768 UUID uuid;
769 if (UUID.TryParse((string)respData["uuid_" + i], out uuid))
770 {
771 FriendRegionInfo info = new FriendRegionInfo();
772 info.isOnline = (bool)respData["isOnline_" + i];
773 if (info.isOnline) info.regionHandle = Convert.ToUInt64(respData["regionHandle_" + i]);
774
775 result.Add(uuid, info);
776 }
777 }
778 else
764 { 779 {
765 FriendRegionInfo info = new FriendRegionInfo(); 780 m_log.WarnFormat("[OGS1 USER SERVICES]: Response to get_presence_info_bulk contained an error in entry {0}", i);
766 info.isOnline = (bool)respData["isOnline_" + i];
767 if (info.isOnline) info.regionHandle = Convert.ToUInt64(respData["regionHandle_" + i]);
768
769 result.Add(uuid, info);
770 } 781 }
771 } 782 }
772 } 783 }