public void Recover() { if (State != RequesterState.Erroring) { return; } State = RequesterState.RequestRecovering; PostPendableAction(OnInitRecover, timeOut, () => { State = RequesterState.Erroring; RequestTimeouted?.Invoke(); }); }
public void Start() { if (IsStarted) { return; } State = RequesterState.RequestStarting; AppModel.AttachConversation(this); if (IsAutoRecoverable) { Peer.AddAutoConnectRequester(this); } PostPendableAction(OnInitRequest, timeOut , () => { RequestTimeouted?.Invoke(); //如果请求超时了,回滚到初始状态。 State = RequesterState.Attached; }); }
protected virtual void OnRequestTimeouted() { RequestTimeouted?.Invoke(); }