@@ -24,18 +24,16 @@ class ServiceClient<TInterface> : IServiceClient, IConnectionKey where TInterfac
2424 private Server _server ;
2525 private ClientConnection _clientConnection ;
2626
27- internal ServiceClient ( ISerializer serializer , TimeSpan requestTimeout , ILogger logger , ConnectionFactory connectionFactory , string sslServer = null , BeforeCallHandler beforeCall = null , EndpointSettings serviceEndpoint = null )
27+ internal ServiceClient ( ISerializer serializer , TimeSpan requestTimeout , ILogger logger , ConnectionFactory connectionFactory , BeforeCallHandler beforeCall = null , EndpointSettings serviceEndpoint = null )
2828 {
2929 _serializer = serializer ;
3030 _requestTimeout = requestTimeout ;
3131 _logger = logger ;
3232 _connectionFactory = connectionFactory ;
33- SslServer = sslServer ;
3433 _beforeCall = beforeCall ;
3534 _serviceEndpoint = serviceEndpoint ;
3635 }
3736 protected int HashCode { get ; init ; }
38- public string SslServer { get ; init ; }
3937 public virtual string Name => _connection ? . Name ;
4038 private bool LogEnabled => _logger . Enabled ( ) ;
4139 Connection IServiceClient . Connection => _connection ;
@@ -190,9 +188,8 @@ private async Task<bool> Connect(CancellationToken cancellationToken)
190188 {
191189 clientConnection . Dispose ( ) ;
192190 throw ;
193- }
194- var stream = SslServer == null ? network : await AuthenticateAsClient ( network ) ;
195- OnNewConnection ( new ( stream , _serializer , _logger , Name ) ) ;
191+ }
192+ OnNewConnection ( new ( network , _serializer , _logger , Name ) ) ;
196193 if ( LogEnabled )
197194 {
198195 Log ( $ "CreateConnection { Name } .") ;
@@ -204,21 +201,6 @@ private async Task<bool> Connect(CancellationToken cancellationToken)
204201 clientConnection . Release ( ) ;
205202 }
206203 return true ;
207- async Task < Stream > AuthenticateAsClient ( Stream network )
208- {
209- var sslStream = new SslStream ( network ) ;
210- try
211- {
212- await sslStream . AuthenticateAsClientAsync ( SslServer ) ;
213- }
214- catch
215- {
216- sslStream . Dispose ( ) ;
217- throw ;
218- }
219- Debug . Assert ( sslStream . IsEncrypted && sslStream . IsSigned ) ;
220- return sslStream ;
221- }
222204 }
223205
224206 private void ReuseClientConnection ( ClientConnection clientConnection )
@@ -276,7 +258,7 @@ protected virtual void Dispose(bool disposing)
276258
277259 public override string ToString ( ) => Name ;
278260
279- public virtual bool Equals ( IConnectionKey other ) => SslServer == other . SslServer ;
261+ public virtual bool Equals ( IConnectionKey other ) => true ;
280262
281263 public virtual ClientConnection CreateClientConnection ( ) => throw new NotImplementedException ( ) ;
282264}
0 commit comments