aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-14 20:40:14 +0000
committerJustin Clarke Casey2009-01-14 20:40:14 +0000
commit46cac455c12bbf2ee2bc9ecb499cb1367ad920c9 (patch)
tree7db41d63a721caed258373cb14953a84fa38d6f5 /OpenSim
parent* Adjust log messages so that we don't get a CONNECTION BEGIN for notificatio... (diff)
downloadopensim-SC_OLD-46cac455c12bbf2ee2bc9ecb499cb1367ad920c9.zip
opensim-SC_OLD-46cac455c12bbf2ee2bc9ecb499cb1367ad920c9.tar.gz
opensim-SC_OLD-46cac455c12bbf2ee2bc9ecb499cb1367ad920c9.tar.bz2
opensim-SC_OLD-46cac455c12bbf2ee2bc9ecb499cb1367ad920c9.tar.xz
* Move the timed_out change to earlier on in the async handler
* There appears to be a bug on mono 1.9.1 (and maybe later), where sometimes the async wait will be signalled even though that async callback has not executed * This change may make it slightly better but it's difficult to tell (it definitely still occurs) * Also this patch closes the wait handle explicitly, as recommended in the MSDN docs. This doesn't have any impact on the bug though
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs13
1 files changed, 9 insertions, 4 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 64e184d..ca48814 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -1567,12 +1567,13 @@ namespace OpenSim.Region.Communications.OGS1
1567 1567
1568 AsyncCallback callback = delegate(IAsyncResult iar) 1568 AsyncCallback callback = delegate(IAsyncResult iar)
1569 { 1569 {
1570 timed_out = false;
1571
1570 Socket s = (Socket)iar.AsyncState; 1572 Socket s = (Socket)iar.AsyncState;
1571 try 1573 try
1572 { 1574 {
1573 s.EndConnect(iar); 1575 s.EndConnect(iar);
1574 available = true; 1576 available = true;
1575 timed_out = false;
1576 } 1577 }
1577 catch (Exception e) 1578 catch (Exception e)
1578 { 1579 {
@@ -1583,10 +1584,12 @@ namespace OpenSim.Region.Communications.OGS1
1583 s.Close(); 1584 s.Close();
1584 }; 1585 };
1585 1586
1587 IAsyncResult ar;
1588
1586 try 1589 try
1587 { 1590 {
1588 Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 1591 Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
1589 IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket); 1592 ar = socket.BeginConnect(m_EndPoint, callback, socket);
1590 ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false); 1593 ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false);
1591 } 1594 }
1592 catch (Exception e) 1595 catch (Exception e)
@@ -1596,9 +1599,11 @@ namespace OpenSim.Region.Communications.OGS1
1596 1599
1597 return false; 1600 return false;
1598 } 1601 }
1602
1603 ar.AsyncWaitHandle.Close();
1599 1604
1600 if (timed_out) 1605 if (timed_out)
1601 { 1606 {
1602 m_log.DebugFormat( 1607 m_log.DebugFormat(
1603 "[OGS1 GRID SERVICES]: socket [{0}] timed out ({1}) waiting to obtain a connection.", 1608 "[OGS1 GRID SERVICES]: socket [{0}] timed out ({1}) waiting to obtain a connection.",
1604 m_EndPoint, timeOut * 1000); 1609 m_EndPoint, timeOut * 1000);