public uint Disconnect(ref IntPtr cxh)
{
try
{
uint returnValue = NativeMethods.EcDoDisconnect(ref cxh);
if (this.bindingHandle != IntPtr.Zero)
{
bool rpcForceShutdownAssociation = bool.Parse(Common.GetConfigurationPropertyValue("RpcForceShutdownAssociation", this.site));
if (rpcForceShutdownAssociation)
{
uint status = NativeMethods.RpcBindingSetOption(this.bindingHandle, 13, 1); // 13 represents RPC_C_OPT_DONT_LINGER option
if (status != 0)
{
this.site.Assert.Fail("Failed to set option on the binding handle, the RpcBindingSetOption method returned status code: {0}", status);
}
}
NativeMethods.RpcBindingFree(ref this.bindingHandle);
this.bindingHandle = IntPtr.Zero;
}
return returnValue;
}
catch (SEHException e)
{
this.site.Log.Add(LogEntryKind.Comment, "EcDoDisconnect throws exception, system error code is {0}, the error message is: {1}", RpcExceptionCode(e), (new Win32Exception((int)RpcExceptionCode(e))).ToString());
// The exception in ECDoDisconnect should be ignored here.
return 0;
}
}