添加超时时间参数设置接口
							parent
							
								
									3b195db157
								
							
						
					
					
						commit
						099cccd2fb
					
				|  | @ -19,6 +19,7 @@ namespace DofLibrary | ||||||
|         public IMessageSender sender { get; private set; } = new MessageSender(); |         public IMessageSender sender { get; private set; } = new MessageSender(); | ||||||
|         private IMessageReceiver _receiver; |         private IMessageReceiver _receiver; | ||||||
|         private bool _running; |         private bool _running; | ||||||
|  | 		private int? _timeoutMillis; | ||||||
| 
 | 
 | ||||||
|         public GameKcpClient(DotNetty.Unity.Level level = DotNetty.Unity.Level.ALL) |         public GameKcpClient(DotNetty.Unity.Level level = DotNetty.Unity.Level.ALL) | ||||||
|         { |         { | ||||||
|  | @ -54,7 +55,8 @@ namespace DofLibrary | ||||||
|             channelConfig.Crc32Check = false; |             channelConfig.Crc32Check = false; | ||||||
|             channelConfig.UseConvChannel = true; |             channelConfig.UseConvChannel = true; | ||||||
|             //channelConfig.Conv = UnityEngine.Random.Range(1, int.MaxValue); |             //channelConfig.Conv = UnityEngine.Random.Range(1, int.MaxValue); | ||||||
|             channelConfig.TimeoutMillis = 10000; | 			if(_timeoutMillis.hasValue) | ||||||
|  |             	channelConfig.TimeoutMillis = _timeoutMillis.Value; | ||||||
| 
 | 
 | ||||||
|             _kcpClient = new KcpClient(); |             _kcpClient = new KcpClient(); | ||||||
|             _kcpClient.init(channelConfig); |             _kcpClient.init(channelConfig); | ||||||
|  | @ -169,6 +171,11 @@ namespace DofLibrary | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | 		public void setTimeoutMillis(int timeoutMillis) | ||||||
|  | 		{ | ||||||
|  | 			_timeoutMillis = timeoutMillis; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// 关闭 Client,应该在游戏结束时调用 |         /// 关闭 Client,应该在游戏结束时调用 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 xiaohang
						xiaohang