aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712008-08-08 10:59:32 +0000
committerlbsa712008-08-08 10:59:32 +0000
commit22f09fbd213ffd414514756b4a7ee0e86325d733 (patch)
tree812fd206280d2f527063a902e0a041612338947f
parentDe-coupling the IClientAPI interface and ClientManager class from the (diff)
downloadopensim-SC_OLD-22f09fbd213ffd414514756b4a7ee0e86325d733.zip
opensim-SC_OLD-22f09fbd213ffd414514756b4a7ee0e86325d733.tar.gz
opensim-SC_OLD-22f09fbd213ffd414514756b4a7ee0e86325d733.tar.bz2
opensim-SC_OLD-22f09fbd213ffd414514756b4a7ee0e86325d733.tar.xz
* All CheckRegion within an instance would use the same, global, bool for 'Available', which would lead to intermittent failures on parallell teleport requests.
* Solidified CheckRegion somewhat, adding a second try if the first failed.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs4
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs11
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs64
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs3
4 files changed, 49 insertions, 33 deletions
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index 28b0e12..57fb82d 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -32,8 +32,8 @@ namespace OpenSim.Framework.Communications
32 public interface IInterRegionCommunications 32 public interface IInterRegionCommunications
33 { 33 {
34 string rdebugRegionName { get; set; } 34 string rdebugRegionName { get; set; }
35 bool Available { get; } 35
36 void CheckRegion(string address, uint port); 36 bool CheckRegion(string address, uint port);
37 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); 37 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
38 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData, int XMLMethod); 38 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData, int XMLMethod);
39 bool RegionUp(SerializableRegionInfo region, ulong regionhandle); 39 bool RegionUp(SerializableRegionInfo region, ulong regionhandle);
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index f967cf7..8d6bbcc 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -51,16 +51,9 @@ namespace OpenSim.Region.Communications.Local
51 51
52 public string _gdebugRegionName = String.Empty; 52 public string _gdebugRegionName = String.Empty;
53 53
54 bool m_bAvailable=true; 54 public bool CheckRegion(string address, uint port)
55
56 public void CheckRegion(string address, uint port)
57 {
58 m_bAvailable = true;
59 }
60
61 public bool Available
62 { 55 {
63 get { return m_bAvailable; } 56 return true;
64 } 57 }
65 58
66 public string gdebugRegionName 59 public string gdebugRegionName
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index a2cddec..af3b666 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -1558,36 +1558,60 @@ namespace OpenSim.Region.Communications.OGS1
1558 bool m_bAvailable = false; 1558 bool m_bAvailable = false;
1559 int timeOut = 10; //10 seconds 1559 int timeOut = 10; //10 seconds
1560 1560
1561 public void CheckRegion(string address, uint port) 1561 public bool CheckRegion(string address, uint port, bool retry)
1562 { 1562 {
1563 m_bAvailable = false; 1563 bool available = false;
1564 IPAddress ia = null; 1564 bool timed_out = true;
1565
1566 IPAddress ia;
1565 IPAddress.TryParse(address, out ia); 1567 IPAddress.TryParse(address, out ia);
1566 IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); 1568 IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port);
1567 AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod);
1568 Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
1569 IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket);
1570 ar.AsyncWaitHandle.WaitOne(timeOut*1000, false);
1571 Thread.Sleep(500);
1572 }
1573 1569
1574 public bool Available 1570 AsyncCallback callback = delegate(IAsyncResult iar)
1575 { 1571 {
1576 get { return m_bAvailable; } 1572 Socket s = (Socket)iar.AsyncState;
1577 } 1573 try
1574 {
1575 s.EndConnect(iar);
1576 available = true;
1577 timed_out = false;
1578 }
1579 catch (Exception e)
1580 {
1581 m_log.DebugFormat("Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace);
1582 }
1583
1584 s.Close();
1585 };
1578 1586
1579 void ConnectedMethod(IAsyncResult ar)
1580 {
1581 Socket socket = (Socket)ar.AsyncState;
1582 try 1587 try
1583 { 1588 {
1584 socket.EndConnect(ar); 1589 Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
1585 m_bAvailable = true; 1590 IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket);
1591 ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false);
1586 } 1592 }
1587 catch (Exception) 1593 catch (Exception e)
1594 {
1595 m_log.DebugFormat("CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace);
1596 return false;
1597 }
1598
1599 if (timed_out)
1588 { 1600 {
1601 m_log.DebugFormat("socket [{0}] timed out ({1}) waiting to obtain a connection.", m_EndPoint, timeOut * 1000);
1602
1603 if (retry)
1604 {
1605 return CheckRegion(address, port, false);
1606 }
1589 } 1607 }
1590 socket.Close(); 1608
1609 return available;
1610 }
1611
1612 public bool CheckRegion(string address, uint port)
1613 {
1614 return CheckRegion(address, port, true);
1591 } 1615 }
1592 1616
1593 public void NoteDeadRegion(ulong regionhandle) 1617 public void NoteDeadRegion(ulong regionhandle)
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index b35e60f..cb37faf 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -580,8 +580,7 @@ namespace OpenSim.Region.Environment.Scenes
580 if (reg.RemotingAddress != "" && reg.RemotingPort != 0) 580 if (reg.RemotingAddress != "" && reg.RemotingPort != 0)
581 { 581 {
582 // region is remote. see if it is up 582 // region is remote. see if it is up
583 m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort); 583 destRegionUp = m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort);
584 destRegionUp = m_commsProvider.InterRegion.Available;
585 } 584 }
586 else 585 else
587 { 586 {