diff options
author | Justin Clarke Casey | 2008-09-20 19:55:49 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-09-20 19:55:49 +0000 |
commit | 41728f8a333e7dd55898cd3b9cc167a3bc43db7c (patch) | |
tree | f8fc8ff12fbf969a7d22e04f567639c4cb96cdc4 /OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |
parent | * refactor: remove unnecessary packet null check in LLClientView (diff) | |
download | opensim-SC_OLD-41728f8a333e7dd55898cd3b9cc167a3bc43db7c.zip opensim-SC_OLD-41728f8a333e7dd55898cd3b9cc167a3bc43db7c.tar.gz opensim-SC_OLD-41728f8a333e7dd55898cd3b9cc167a3bc43db7c.tar.bz2 opensim-SC_OLD-41728f8a333e7dd55898cd3b9cc167a3bc43db7c.tar.xz |
* Tidy up OGS1GridServices
* Remove what should be unnecessary RemoteException catches when executing local backend calls
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 140 |
1 files changed, 39 insertions, 101 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index a59a6a5..45d0931 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -51,8 +51,9 @@ namespace OpenSim.Region.Communications.OGS1 | |||
51 | { | 51 | { |
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | // FIXME: LocalBackEndServices should to be refactored into a separate common parent class rather than | 54 | /// <summary> |
55 | // encapsulated. | 55 | /// Encapsulate local backend services for manipulation of local regions |
56 | /// </summary> | ||
56 | private LocalBackEndServices m_localBackend = new LocalBackEndServices(); | 57 | private LocalBackEndServices m_localBackend = new LocalBackEndServices(); |
57 | 58 | ||
58 | private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); | 59 | private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); |
@@ -64,32 +65,25 @@ namespace OpenSim.Region.Communications.OGS1 | |||
64 | public BaseHttpServer httpListener; | 65 | public BaseHttpServer httpListener; |
65 | public NetworkServersInfo serversInfo; | 66 | public NetworkServersInfo serversInfo; |
66 | public BaseHttpServer httpServer; | 67 | public BaseHttpServer httpServer; |
67 | 68 | ||
68 | public string _gdebugRegionName = String.Empty; | ||
69 | |||
70 | public string gdebugRegionName | 69 | public string gdebugRegionName |
71 | { | 70 | { |
72 | get { return _gdebugRegionName; } | 71 | get { return m_localBackend.gdebugRegionName; } |
73 | set { _gdebugRegionName = value; } | 72 | set { m_localBackend.gdebugRegionName = value; } |
74 | } | 73 | } |
75 | |||
76 | public string _rdebugRegionName = String.Empty; | ||
77 | 74 | ||
78 | public string rdebugRegionName | 75 | public string rdebugRegionName |
79 | { | 76 | { |
80 | get { return _rdebugRegionName; } | 77 | get { return _rdebugRegionName; } |
81 | set { _rdebugRegionName = value; } | 78 | set { _rdebugRegionName = value; } |
82 | } | 79 | } |
80 | private string _rdebugRegionName = String.Empty; | ||
83 | 81 | ||
84 | /// <summary> | ||
85 | /// Doesn't have any effect yet! | ||
86 | /// </summary> | ||
87 | public bool RegionLoginsEnabled | 82 | public bool RegionLoginsEnabled |
88 | { | 83 | { |
89 | get { return m_regionLoginsEnabled; } | 84 | get { return m_localBackend.RegionLoginsEnabled; } |
90 | set { m_regionLoginsEnabled = value; } | 85 | set { m_localBackend.RegionLoginsEnabled = value; } |
91 | } | 86 | } |
92 | private bool m_regionLoginsEnabled; | ||
93 | 87 | ||
94 | /// <summary> | 88 | /// <summary> |
95 | /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers | 89 | /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers |
@@ -195,6 +189,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
195 | "[OGS1 GRID SERVICES]: Region {0} successfully registered with grid at {1}", | 189 | "[OGS1 GRID SERVICES]: Region {0} successfully registered with grid at {1}", |
196 | regionInfo.RegionName, serversInfo.GridURL); | 190 | regionInfo.RegionName, serversInfo.GridURL); |
197 | } | 191 | } |
192 | |||
198 | return m_localBackend.RegisterRegion(regionInfo); | 193 | return m_localBackend.RegisterRegion(regionInfo); |
199 | } | 194 | } |
200 | 195 | ||
@@ -223,7 +218,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
223 | return false; | 218 | return false; |
224 | } | 219 | } |
225 | 220 | ||
226 | // What does DeregisterRegion() do? | ||
227 | return m_localBackend.DeregisterRegion(regionInfo); | 221 | return m_localBackend.DeregisterRegion(regionInfo); |
228 | } | 222 | } |
229 | 223 | ||
@@ -572,6 +566,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
572 | param["ymax"] = maxY; | 566 | param["ymax"] = maxY; |
573 | IList parameters = new ArrayList(); | 567 | IList parameters = new ArrayList(); |
574 | parameters.Add(param); | 568 | parameters.Add(param); |
569 | |||
575 | try | 570 | try |
576 | { | 571 | { |
577 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); | 572 | XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); |
@@ -646,7 +641,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
646 | 641 | ||
647 | XmlRpcResponse resp = new XmlRpcResponse(); | 642 | XmlRpcResponse resp = new XmlRpcResponse(); |
648 | 643 | ||
649 | if (!m_regionLoginsEnabled) | 644 | if (!RegionLoginsEnabled) |
650 | { | 645 | { |
651 | m_log.InfoFormat( | 646 | m_log.InfoFormat( |
652 | "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", | 647 | "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", |
@@ -708,7 +703,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
708 | /// <returns></returns> | 703 | /// <returns></returns> |
709 | public XmlRpcResponse LogOffUser(XmlRpcRequest request) | 704 | public XmlRpcResponse LogOffUser(XmlRpcRequest request) |
710 | { | 705 | { |
711 | m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called "); | 706 | m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called"); |
707 | |||
712 | Hashtable requestData = (Hashtable)request.Params[0]; | 708 | Hashtable requestData = (Hashtable)request.Params[0]; |
713 | string message = (string)requestData["message"]; | 709 | string message = (string)requestData["message"]; |
714 | UUID agentID = UUID.Zero; | 710 | UUID agentID = UUID.Zero; |
@@ -718,11 +714,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
718 | 714 | ||
719 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | 715 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); |
720 | 716 | ||
721 | |||
722 | m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message); | 717 | m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message); |
723 | 718 | ||
724 | |||
725 | |||
726 | return new XmlRpcResponse(); | 719 | return new XmlRpcResponse(); |
727 | } | 720 | } |
728 | 721 | ||
@@ -913,9 +906,9 @@ namespace OpenSim.Region.Communications.OGS1 | |||
913 | } | 906 | } |
914 | remObject = null; | 907 | remObject = null; |
915 | m_log.Info("[OGS1 GRID SERVICES]: " + | 908 | m_log.Info("[OGS1 GRID SERVICES]: " + |
916 | gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + | 909 | m_localBackend._gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + |
917 | agentData.firstname + " " + agentData.lastname + " and got " + | 910 | agentData.firstname + " " + agentData.lastname + " and got " + |
918 | retValue.ToString()); | 911 | retValue.ToString()); |
919 | 912 | ||
920 | return retValue; | 913 | return retValue; |
921 | } | 914 | } |
@@ -1029,7 +1022,9 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1029 | m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); | 1022 | m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); |
1030 | } | 1023 | } |
1031 | remObject = null; | 1024 | remObject = null; |
1032 | m_log.Info("[INTER]: " + gdebugRegionName + ": OGS1 tried to inform region I'm up"); | 1025 | |
1026 | m_log.Info( | ||
1027 | "[INTER]: " + m_localBackend._gdebugRegionName + ": OGS1 tried to inform region I'm up"); | ||
1033 | 1028 | ||
1034 | return retValue; | 1029 | return retValue; |
1035 | } | 1030 | } |
@@ -1472,62 +1467,38 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1472 | { | 1467 | { |
1473 | //m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); | 1468 | //m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); |
1474 | 1469 | ||
1475 | try | 1470 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); |
1476 | { | ||
1477 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); | ||
1478 | } | ||
1479 | catch (RemotingException) | ||
1480 | { | ||
1481 | //m_log.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); | ||
1482 | return false; | ||
1483 | } | ||
1484 | } | 1471 | } |
1485 | 1472 | ||
1486 | public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) | 1473 | public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) |
1487 | { | 1474 | { |
1488 | m_log.Info("[OGS1 GRID SERVICES]: " + | 1475 | m_log.Info( |
1489 | gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.X + | 1476 | "[OGS1 GRID SERVICES]: " + |
1490 | "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); | 1477 | m_localBackend._gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.X + |
1478 | "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); | ||
1479 | |||
1491 | RegionInfo nRegionInfo = new RegionInfo(); | 1480 | RegionInfo nRegionInfo = new RegionInfo(); |
1492 | nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); | 1481 | nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); |
1493 | nRegionInfo.ExternalHostName = regionData.IPADDR; | 1482 | nRegionInfo.ExternalHostName = regionData.IPADDR; |
1494 | nRegionInfo.RegionLocX = regionData.X; | 1483 | nRegionInfo.RegionLocX = regionData.X; |
1495 | nRegionInfo.RegionLocY = regionData.Y; | 1484 | nRegionInfo.RegionLocY = regionData.Y; |
1496 | 1485 | ||
1497 | 1486 | lock (m_deadRegionCache) | |
1498 | try | ||
1499 | { | 1487 | { |
1500 | lock (m_deadRegionCache) | 1488 | if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) |
1501 | { | 1489 | { |
1502 | if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) | 1490 | m_deadRegionCache.Remove(nRegionInfo.RegionHandle); |
1503 | { | ||
1504 | m_deadRegionCache.Remove(nRegionInfo.RegionHandle); | ||
1505 | } | ||
1506 | } | 1491 | } |
1507 | |||
1508 | return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); | ||
1509 | } | 1492 | } |
1510 | 1493 | ||
1511 | catch (RemotingException e) | 1494 | return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); |
1512 | { | ||
1513 | m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); | ||
1514 | return false; | ||
1515 | } | ||
1516 | } | 1495 | } |
1517 | 1496 | ||
1518 | public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 1497 | public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
1519 | { | 1498 | { |
1520 | //m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update"); | 1499 | //m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update"); |
1521 | 1500 | ||
1522 | try | 1501 | return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); |
1523 | { | ||
1524 | return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); | ||
1525 | } | ||
1526 | catch (RemotingException e) | ||
1527 | { | ||
1528 | m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); | ||
1529 | return false; | ||
1530 | } | ||
1531 | } | 1502 | } |
1532 | 1503 | ||
1533 | /// <summary> | 1504 | /// <summary> |
@@ -1538,18 +1509,9 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1538 | /// <returns></returns> | 1509 | /// <returns></returns> |
1539 | public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) | 1510 | public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) |
1540 | { | 1511 | { |
1541 | // Is this necessary? | 1512 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); |
1542 | try | 1513 | |
1543 | { | 1514 | return true; |
1544 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); | ||
1545 | return true; | ||
1546 | //m_localBackend. | ||
1547 | } | ||
1548 | catch (RemotingException e) | ||
1549 | { | ||
1550 | m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); | ||
1551 | return false; | ||
1552 | } | ||
1553 | } | 1515 | } |
1554 | 1516 | ||
1555 | /// <summary> | 1517 | /// <summary> |
@@ -1561,41 +1523,17 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1561 | /// <returns></returns> | 1523 | /// <returns></returns> |
1562 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | 1524 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) |
1563 | { | 1525 | { |
1564 | try | 1526 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
1565 | { | ||
1566 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | ||
1567 | } | ||
1568 | catch (RemotingException e) | ||
1569 | { | ||
1570 | m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); | ||
1571 | return false; | ||
1572 | } | ||
1573 | } | 1527 | } |
1574 | 1528 | ||
1575 | public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) | 1529 | public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) |
1576 | { | 1530 | { |
1577 | try | 1531 | return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); |
1578 | { | ||
1579 | return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); | ||
1580 | } | ||
1581 | catch (RemotingException e) | ||
1582 | { | ||
1583 | m_log.Error("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); | ||
1584 | return false; | ||
1585 | } | ||
1586 | } | 1532 | } |
1587 | 1533 | ||
1588 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | 1534 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) |
1589 | { | 1535 | { |
1590 | try | 1536 | return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); |
1591 | { | ||
1592 | return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
1593 | } | ||
1594 | catch (RemotingException) | ||
1595 | { | ||
1596 | m_log.Info("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to neighbour to tell it to close a child connection"); | ||
1597 | return false; | ||
1598 | } | ||
1599 | } | 1537 | } |
1600 | 1538 | ||
1601 | #endregion | 1539 | #endregion |