* 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 though0.6.2-post-fixes
parent
8a08e4980d
commit
46cac455c1
|
@ -1567,12 +1567,13 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
|
|
||||||
AsyncCallback callback = delegate(IAsyncResult iar)
|
AsyncCallback callback = delegate(IAsyncResult iar)
|
||||||
{
|
{
|
||||||
|
timed_out = false;
|
||||||
|
|
||||||
Socket s = (Socket)iar.AsyncState;
|
Socket s = (Socket)iar.AsyncState;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
s.EndConnect(iar);
|
s.EndConnect(iar);
|
||||||
available = true;
|
available = true;
|
||||||
timed_out = false;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1583,10 +1584,12 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
s.Close();
|
s.Close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IAsyncResult ar;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket);
|
ar = socket.BeginConnect(m_EndPoint, callback, socket);
|
||||||
ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false);
|
ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -1597,6 +1600,8 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ar.AsyncWaitHandle.Close();
|
||||||
|
|
||||||
if (timed_out)
|
if (timed_out)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
|
|
Loading…
Reference in New Issue