@@ -153,6 +153,11 @@ public TimeSpan KeepAliveInterval
153
153
/// </example>
154
154
public event EventHandler < HostKeyEventArgs > HostKeyReceived ;
155
155
156
+ /// <summary>
157
+ /// Occurs when server identification received.
158
+ /// </summary>
159
+ public event EventHandler < SshIdentificationEventArgs > ServerIdentificationReceived ;
160
+
156
161
/// <summary>
157
162
/// Initializes a new instance of the <see cref="BaseClient"/> class.
158
163
/// </summary>
@@ -390,6 +395,11 @@ private void Session_HostKeyReceived(object sender, HostKeyEventArgs e)
390
395
HostKeyReceived ? . Invoke ( this , e ) ;
391
396
}
392
397
398
+ private void Session_ServerIdentificationReceived ( object sender , SshIdentificationEventArgs e )
399
+ {
400
+ ServerIdentificationReceived ? . Invoke ( this , e ) ;
401
+ }
402
+
393
403
/// <summary>
394
404
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
395
405
/// </summary>
@@ -532,6 +542,7 @@ private Timer CreateKeepAliveTimer(TimeSpan dueTime, TimeSpan period)
532
542
private ISession CreateAndConnectSession ( )
533
543
{
534
544
var session = _serviceFactory . CreateSession ( ConnectionInfo , _serviceFactory . CreateSocketFactory ( ) ) ;
545
+ session . ServerIdentificationReceived += Session_ServerIdentificationReceived ;
535
546
session . HostKeyReceived += Session_HostKeyReceived ;
536
547
session . ErrorOccured += Session_ErrorOccured ;
537
548
@@ -550,6 +561,7 @@ private ISession CreateAndConnectSession()
550
561
private async Task < ISession > CreateAndConnectSessionAsync ( CancellationToken cancellationToken )
551
562
{
552
563
var session = _serviceFactory . CreateSession ( ConnectionInfo , _serviceFactory . CreateSocketFactory ( ) ) ;
564
+ session . ServerIdentificationReceived += Session_ServerIdentificationReceived ;
553
565
session . HostKeyReceived += Session_HostKeyReceived ;
554
566
session . ErrorOccured += Session_ErrorOccured ;
555
567
@@ -569,6 +581,7 @@ private void DisposeSession(ISession session)
569
581
{
570
582
session . ErrorOccured -= Session_ErrorOccured ;
571
583
session . HostKeyReceived -= Session_HostKeyReceived ;
584
+ session . ServerIdentificationReceived -= Session_ServerIdentificationReceived ;
572
585
session . Dispose ( ) ;
573
586
}
574
587
0 commit comments