File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
projects/client/RabbitMQ.Client/src/client/impl Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -578,6 +578,8 @@ public void NotifyHeartbeatThread()
578
578
579
579
public void MainLoop ( )
580
580
{
581
+ Thread . GetDomain ( ) . DomainUnload += new EventHandler ( HandleDomainUnload ) ;
582
+
581
583
bool shutdownCleanly = false ;
582
584
try
583
585
{
@@ -682,7 +684,16 @@ public void FinishClose()
682
684
m_model0 . SetCloseReason ( m_closeReason ) ;
683
685
m_model0 . FinishClose ( ) ;
684
686
}
685
-
687
+
688
+ /// <remarks>
689
+ /// We need to close the socket, otherwise attempting to unload the domain
690
+ /// could cause a CannotUnloadAppDomainException
691
+ /// </remarks>
692
+ public void HandleDomainUnload ( object sender , EventArgs ea )
693
+ {
694
+ Abort ( CommonFraming . Constants . InternalError , "Domain Unload" ) ;
695
+ }
696
+
686
697
public bool HardProtocolExceptionHandler ( HardProtocolException hpe )
687
698
{
688
699
if ( SetCloseReason ( hpe . ShutdownReason ) )
You can’t perform that action at this time.
0 commit comments