This is an automated email from the ASF dual-hosted git repository.

michaelpearce pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git


The following commit(s) were added to refs/heads/master by this push:
     new 3af0781  AMQNET-597: Remotely closed session is not removed from 
AmqpConnection
     new b90d0f0  Merge pull request #16 from Havret/AMQNET-597
3af0781 is described below

commit 3af078132e93385c04c6ddfd034b29d7a640f18b
Author: Havret <[email protected]>
AuthorDate: Mon Jul 29 21:29:51 2019 +0200

    AMQNET-597: Remotely closed session is not removed from AmqpConnection
    
    (cherry picked from commit 0ac99d355209416be0390c92a8070b26b4bd5658)
---
 src/NMS.AMQP/Provider/Amqp/AmqpSession.cs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/NMS.AMQP/Provider/Amqp/AmqpSession.cs 
b/src/NMS.AMQP/Provider/Amqp/AmqpSession.cs
index 7862e5b..4f8c9e5 100644
--- a/src/NMS.AMQP/Provider/Amqp/AmqpSession.cs
+++ b/src/NMS.AMQP/Provider/Amqp/AmqpSession.cs
@@ -63,7 +63,10 @@ namespace Apache.NMS.AMQP.Provider.Amqp
                 });
             underlyingSession.AddClosedCallback((sender, error) =>
             {
-                tcs.TrySetException(ExceptionSupport.GetException(error));
+                if (!tcs.TrySetException(ExceptionSupport.GetException(error)))
+                {
+                    Connection.RemoveSession(sessionInfo.Id);
+                }
             });
             return tcs.Task;
         }
@@ -123,7 +126,7 @@ namespace Apache.NMS.AMQP.Provider.Amqp
         {
             consumers.TryRemove(consumerId, out _);
         }
-        
+
         public void RemoveProducer(Id producerId)
         {
             producers.TryRemove(producerId, out _);

Reply via email to