protected override void PreStart()
{
if (_handle == null)
{
Transport
.Associate(RemoteAddress, _refuseUid)
.ContinueWith(handle =>
{
if (handle.IsFaulted)
{
var inner = handle.Exception?.Flatten().InnerException;
return (object)new Status.Failure(new InvalidAssociationException("Association failure", inner));
}
return new Handle(handle.Result);
}, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default)
.PipeTo(Self);
}
else
{
_reader = StartReadEndpoint(_handle);
}
var ackIdleInterval = new TimeSpan(Settings.SysMsgAckTimeout.Ticks / 2);
_ackIdleTimerCancelable = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(ackIdleInterval, ackIdleInterval, Self, AckIdleCheckTimer.Instance, Self);
}