summaryrefslogtreecommitdiff
path: root/csharp/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2015-07-27 14:04:29 -0230
committerDwayne Boone <dwayne@zeroc.com>2015-07-27 14:04:29 -0230
commit0786018592100adc3db37e6d171df226f7f04129 (patch)
tree6a9e2d59ac84d97a381b8059847df18460b2b710 /csharp/src
parentICE-6628 fixed warning in android facets test (diff)
downloadice-0786018592100adc3db37e6d171df226f7f04129.tar.bz2
ice-0786018592100adc3db37e6d171df226f7f04129.tar.xz
ice-0786018592100adc3db37e6d171df226f7f04129.zip
ICE-6302 Fixed SessionHelper to terminate connection attempt when destroy is called
Diffstat (limited to 'csharp/src')
-rw-r--r--csharp/src/Glacier2/SessionHelper.cs31
1 files changed, 25 insertions, 6 deletions
diff --git a/csharp/src/Glacier2/SessionHelper.cs b/csharp/src/Glacier2/SessionHelper.cs
index f9432d6003f..d1f60742c74 100644
--- a/csharp/src/Glacier2/SessionHelper.cs
+++ b/csharp/src/Glacier2/SessionHelper.cs
@@ -76,20 +76,22 @@ public class SessionHelper
if(!_connected)
{
//
- // In this case a connecting session is being
- // destroyed. The communicator and session will be
- // destroyed when the connection establishment has
- // completed.
+ // In this case a connecting session is being destroyed.
+ // We destroy the communicator to trigger the immediate
+ // failure of the connection establishment.
//
+ Thread t1 = new Thread(new ThreadStart(destroyCommunicator));
+ t1.Start();
return;
}
_session = null;
_connected = false;
+
//
// Run destroyInternal in a thread because it makes remote invocations.
//
- Thread t = new Thread(new ThreadStart(destroyInternal));
- t.Start();
+ Thread t2 = new Thread(new ThreadStart(destroyInternal));
+ t2.Start();
}
}
@@ -394,6 +396,23 @@ public class SessionHelper
}, null);
}
+ private void
+ destroyCommunicator()
+ {
+ Ice.Communicator communicator;
+ lock(this)
+ {
+ communicator = _communicator;
+ }
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Exception)
+ {
+ }
+ }
+
delegate Glacier2.SessionPrx ConnectStrategy(Glacier2.RouterPrx router);
private void