THRIFT-2339 Uncaught exception in thrift c# driver
Patch: Janis Ser
Github Pull Request: This closes #79
----
commit d650ca3380aac39eae1f17dc72d4097eb3394562
Author: JSSTR <janis.sermulins@struq.com>
Date: 2014-01-29T13:49:51Z
Update TSocket.cs
Make sure to catch all exceptions in the ConnectCallback.
----
diff --git a/lib/csharp/src/Transport/TSocket.cs b/lib/csharp/src/Transport/TSocket.cs
index 7717cfb..35fbe97 100644
--- a/lib/csharp/src/Transport/TSocket.cs
+++ b/lib/csharp/src/Transport/TSocket.cs
@@ -177,16 +177,21 @@
if( hlp.Client.Client != null)
hlp.Client.EndConnect(asyncres);
}
- catch (SocketException)
+ catch (Exception)
{
// catch that away
}
if (hlp.DoCleanup)
{
- asyncres.AsyncWaitHandle.Close();
- if (hlp.Client is IDisposable)
- ((IDisposable)hlp.Client).Dispose();
+ try {
+ asyncres.AsyncWaitHandle.Close();
+ } catch (Exception) {}
+
+ try {
+ if (hlp.Client is IDisposable)
+ ((IDisposable)hlp.Client).Dispose();
+ } catch (Exception) {}
hlp.Client = null;
}
}