Skip to content

Commit e0933d8

Browse files
committed
Redo the SslOption integration into AmqpTcpEndpoint
After looking at the eventual integration into ConnectionFactory, I've found it better to restructure things a bit differently so that we create our SslOption very early on in the process and just pass it down all the way to the SocketFrameHandler. This commit does the following: * Rename SslOption Property to Ssl, so we actually create a Namespace, which allows us to do: endpoint.Ssl.Enabled, endpoint.Ssl.Foo, etc * Remove SslIsEnabled Property, it now resides inside the SslOption object itself, and AmqpTcpEndpoint does not concern itself with it anymore * Remove the UseSsl() family of methods. * Implement an overloaded constructor that accepts an SslOption object. * Reimplement the existing constructor in terms of the new constructor above, so that by default, Ssl is disabled
1 parent ad3bda2 commit e0933d8

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

src/client/api/AmqpTcpEndpoint.cs

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -91,47 +91,35 @@ public int Port
9191
set { m_port = value; }
9292
}
9393

94-
private bool m_sslIsEnabled;
9594

96-
public bool SslIsEnabled
97-
{
98-
get { return m_sslIsEnabled; }
99-
set { m_sslIsEnabled = value; }
100-
}
101-
102-
private SslOption m_sslOption;
95+
private SslOption m_ssl;
10396
///<summary>Retrieve the SSL options for this AmqpTcpEndpoint.
10497
///If not set, null is returned</summary>
105-
public SslOption SslOption
98+
public SslOption Ssl
10699
{
107-
get { return m_sslOption; }
100+
get { return m_ssl; }
101+
set { m_ssl = value; }
108102
}
109103

110104
///<summary>Construct an AmqpTcpEndpoint with the given
111105
///IProtocol, hostname, and port number. If the port number is
112106
///-1, the default port number for the IProtocol will be
113107
///used.</summary>
114-
public AmqpTcpEndpoint(IProtocol protocolVariant, string hostname, int portOrMinusOne)
115-
{
116-
m_protocol = protocolVariant;
117-
m_hostName = hostname;
118-
m_port = portOrMinusOne;
119-
}
120-
121-
public void UseSsl(string certPath, string serverName)
122-
{
123-
m_sslOption = new SslOption(serverName, certPath);
124-
m_sslIsEnabled = true;
125-
}
126-
127-
public void UseSsl(string certPath)
108+
public AmqpTcpEndpoint(IProtocol protocolVariant, string hostname, int portOrMinusOne):
109+
this(protocolVariant, hostname, portOrMinusOne, new SslOption())
128110
{
129-
UseSsl(certPath, m_hostName);
130111
}
131112

132-
public void UseSsl()
113+
///<summary>Construct an AmqpTcpEndpoint with the given
114+
///IProtocol, hostname, port number and Ssl option. If the port
115+
///number is -1, the default port number for the IProtocol
116+
///will be used.</summary>
117+
public AmqpTcpEndpoint(IProtocol protocolVariant, string hostname, int portOrMinusOne, SslOption ssl)
133118
{
134-
UseSsl("", m_hostName);
119+
m_protocol = protocolVariant;
120+
m_hostName = hostname;
121+
m_port = portOrMinusOne;
122+
m_ssl = ssl;
135123
}
136124

137125
///<summary>Returns a URI-like string of the form

0 commit comments

Comments
 (0)