@@ -231,10 +231,7 @@ public ConnectionSettings(Uri uri,
231
231
path : "/" ,
232
232
scheme : scheme ) ;
233
233
234
- if ( _address . UseSsl && _tlsSettings == null )
235
- {
236
- _tlsSettings = new TlsSettings ( ) ;
237
- }
234
+ _tlsSettings = InitTlsSettings ( ) ;
238
235
}
239
236
240
237
public ConnectionSettings ( string scheme ,
@@ -255,19 +252,19 @@ public ConnectionSettings(string scheme,
255
252
throw new ArgumentOutOfRangeException ( nameof ( scheme ) , "scheme must be 'amqp' or 'amqps'" ) ;
256
253
}
257
254
258
- _address = new Address ( host : host , port : port ,
259
- user : user , password : password ,
260
- path : "/" , scheme : scheme ) ;
255
+ _address = new Address ( host : host ,
256
+ port : port ,
257
+ user : user ,
258
+ password : password ,
259
+ path : "/" ,
260
+ scheme : scheme ) ;
261
261
262
262
if ( virtualHost is not null )
263
263
{
264
264
_virtualHost = virtualHost ;
265
265
}
266
266
267
- if ( _address . UseSsl && _tlsSettings == null )
268
- {
269
- _tlsSettings = new TlsSettings ( ) ;
270
- }
267
+ _tlsSettings = InitTlsSettings ( ) ;
271
268
}
272
269
273
270
protected ConnectionSettings (
@@ -424,6 +421,18 @@ protected static string ProcessUriSegmentsForVirtualHost(Uri uri)
424
421
}
425
422
}
426
423
424
+ private TlsSettings ? InitTlsSettings ( )
425
+ {
426
+ if ( _address . UseSsl && _tlsSettings is null )
427
+ {
428
+ return new TlsSettings ( ) ;
429
+ }
430
+ else
431
+ {
432
+ return null ;
433
+ }
434
+ }
435
+
427
436
///<summary>
428
437
/// Unescape a string, protecting '+'.
429
438
/// </summary>
0 commit comments