Skip to content

Commit 96f061d

Browse files
author
Alexandru Scvortov
committed
by default, port is 5671 when ConnectionFactory.Ssl.Enabled is set
1 parent 10647ec commit 96f061d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

projects/client/RabbitMQ.Client/src/client/api/AmqpTcpEndpoint.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ namespace RabbitMQ.Client
7474
public class AmqpTcpEndpoint
7575
{
7676
///<summary>Indicates that the default port for the protocol should be used</summary>
77+
public const int DefaultAMQPSSLPort = 5671;
7778
public const int UseDefaultPort = -1;
7879

7980
private IProtocol m_protocol;
@@ -98,7 +99,13 @@ public string HostName
9899
///port number for the IProtocol to be used.</summary>
99100
public int Port
100101
{
101-
get { return (m_port == UseDefaultPort) ? m_protocol.DefaultPort : m_port; }
102+
get {
103+
if (m_port != UseDefaultPort)
104+
return m_port;
105+
if (m_ssl.Enabled)
106+
return DefaultAMQPSSLPort;
107+
return m_protocol.DefaultPort;
108+
}
102109
set { m_port = value; }
103110
}
104111

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ public AmqpTcpEndpoint Endpoint
172172
Protocol = value.Protocol;
173173
Port = value.Port;
174174
HostName = value.HostName;
175+
Ssl = value.Ssl;
175176
}
176177
}
177178

0 commit comments

Comments
 (0)