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.
Zero/ZeroLevel/Services/Network/Model/RequestInfo.cs

39 lines
920 B

6 years ago
using System;
namespace ZeroLevel.Network
6 years ago
{
internal sealed class RequestInfo
{
private Action<Frame> _handler;
private Action<string> _failHandler;
private long _timestamp;
public long Timestamp { get { return _timestamp; } }
private bool _sended;
public bool Sended { get { return _sended; } }
public void Reset(Action<Frame> handler, Action<string> failHandler)
{
_sended = false;
6 years ago
_handler = handler;
_failHandler = failHandler;
}
public void StartSend()
{
_sended = true;
_timestamp = DateTime.UtcNow.Ticks;
}
public void Success(Frame frame)
{
_handler(frame);
frame?.Release();
}
public void Fail(string reasonPhrase)
{
_failHandler(reasonPhrase);
}
}
6 years ago
}

Powered by TurnKey Linux.