@@ -12,7 +12,6 @@ namespace Quick.Protocol
1212{
1313 public class QpServerChannel : QpChannel
1414 {
15- private QpServer server ;
1615 private Stream stream ;
1716 private CancellationTokenSource cts ;
1817 private QpServerOptions options ;
@@ -22,7 +21,7 @@ public class QpServerChannel : QpChannel
2221 private List < CommandExecuterManager > authedCommandExecuterManagerList = null ;
2322 //通过认证后,才允许使用的通知处理器管理器列表
2423 private List < NoticeHandlerManager > authedNoticeHandlerManagerList = null ;
25-
24+
2625 public override string ChannelName => channelName ;
2726
2827 /// <summary>
@@ -34,9 +33,8 @@ public class QpServerChannel : QpChannel
3433 /// </summary>
3534 internal event EventHandler AuchenticateTimeout ;
3635
37- public QpServerChannel ( QpServer server , Stream stream , string channelName , CancellationToken cancellationToken , QpServerOptions options ) : base ( options )
36+ public QpServerChannel ( Stream stream , string channelName , CancellationToken cancellationToken , QpServerOptions options ) : base ( options )
3837 {
39- this . server = server ;
4038 this . stream = stream ;
4139 this . channelName = channelName ;
4240 this . options = options ;
@@ -64,7 +62,7 @@ public QpServerChannel(QpServer server, Stream stream, string channelName, Cance
6462 BeginNetstat ( cts . Token ) ;
6563
6664 //如果认证超时时间后没有通过认证,则断开连接
67- if ( options . AuthenticateTimeout > 0 )
65+ if ( options . AuthenticateTimeout > 0 )
6866 Task . Delay ( options . AuthenticateTimeout , cts . Token ) . ContinueWith ( t =>
6967 {
7068 //如果已经取消或者已经连接
@@ -74,13 +72,13 @@ public QpServerChannel(QpServer server, Stream stream, string channelName, Cance
7472 if ( LogUtils . LogConnection )
7573 LogUtils . Log ( "[Connection]{0} Authenticate timeout." , channelName ) ;
7674
77- if ( stream != null )
75+ if ( stream != null )
7876 {
7977 try
8078 {
8179 stream . Close ( ) ;
8280 stream . Dispose ( ) ;
83- stream = null ;
81+ stream = null ;
8482 }
8583 catch { }
8684 }
@@ -117,7 +115,7 @@ private Commands.Authenticate.Response authenticate(QpChannel handler, Commands.
117115 } ) ;
118116 throw new CommandException ( 1 , "Authenticate failed." ) ;
119117 }
120- IsConnected = true ;
118+ IsConnected = true ;
121119 Auchenticated ? . Invoke ( this , EventArgs . Empty ) ;
122120 return new Commands . Authenticate . Response ( ) ;
123121 }
@@ -168,7 +166,6 @@ protected override void OnReadError(Exception exception)
168166 if ( exception is ProtocolException )
169167 {
170168 var protocolException = ( ProtocolException ) exception ;
171- server . RemoveChannel ( this ) ;
172169 if ( LogUtils . LogConnection )
173170 LogUtils . Log ( "[ProtocolErrorHandler]{0}: Begin ProtocolErrorHandler invoke..." , DateTime . Now ) ;
174171
0 commit comments