mirror of https://github.com/ogoun/Zero.git
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							40 lines
						
					
					
						
							925 B
						
					
					
				
			
		
		
	
	
							40 lines
						
					
					
						
							925 B
						
					
					
				| using System;
 | |
| 
 | |
| namespace ZeroLevel.Network
 | |
| {
 | |
|     internal sealed class RequestInfo
 | |
|     {
 | |
|         private Action<byte[]> _handler;
 | |
|         private Action<string> _failHandler;
 | |
|         private long _timestamp;
 | |
|         public long Timestamp { get { return _timestamp; } }
 | |
|         private bool _sended;
 | |
|         public bool Sended { get { return _sended; } }
 | |
| 
 | |
|         public RequestInfo() { }
 | |
| 
 | |
|         public void Reset(Action<byte[]> handler, Action<string> failHandler)
 | |
|         {
 | |
|             _sended = false;
 | |
|             _handler = handler;
 | |
|             _failHandler = failHandler;
 | |
|         }
 | |
| 
 | |
|         public void StartSend()
 | |
|         {
 | |
|             _sended = true;
 | |
|             _timestamp = DateTime.UtcNow.Ticks;
 | |
|         }
 | |
| 
 | |
|         public void Success(byte[] data)
 | |
|         {
 | |
|             _handler(data);
 | |
|         }
 | |
| 
 | |
|         public void Fail(string reasonPhrase)
 | |
|         {
 | |
|             _failHandler(reasonPhrase);
 | |
|         }
 | |
|     }
 | |
| }
 |