Azure / amqpnetlite

AMQP 1.0 .NET Library
Apache License 2.0
401 stars 143 forks source link

Closing AMQPS connection does not close TCP connection #525

Closed johansme closed 2 years ago

johansme commented 2 years ago

When a Connection object is set up to use AMQPS, the underlying TcpTransport uses an SslStream for the TCP communication. The SslStream wraps a NetworkStream, and is correctly set up so that disposing the SslStream also disposes the NetworkStream. However, the NetworkStream is set up using only the Socket object as a constructor argument. The single parameter constructor of NetworkStream means that the NetworkStream does not own the Socket object, and so disposing the NetworkStream does not close the Socket. To properly close the Socket, and the corresponding TCP connection, the constructor on this line should be new NetworkStream(socket, true) instead of new NetworkStream(socket).

kennethmyhra commented 2 years ago

@xinchen10 do you have an ETA for the next release? This is a fix that would be nice to get tested as soon as possible for us.

xinchen10 commented 2 years ago

v2.4.5 is released.