Пример #1
0
        public static Pipe ConnectTo(this Pipe pipe,
                                     string remoteName,
                                     Action <Pipe, Exception> connectedAction)
        {
            if (pipe is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.pipe);
            }
            if (string.IsNullOrEmpty(remoteName))
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.remoteName);
            }
            if (connectedAction is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.connectedAction);
            }

            PipeConnect request = null;

            try
            {
                request = new PipeConnect(pipe, remoteName, connectedAction);
            }
            catch (Exception)
            {
                request?.Dispose();
                throw;
            }

            return(pipe);
        }
Пример #2
0
        protected override void Initialize()
        {
            Debug.Assert(this.pipe == null);

            this.pipe = new Pipe(this.UnsafeLoop, true);
            PipeConnect request = null;

            try
            {
                request = new PipeConnect(this);
            }
            catch (Exception exception)
            {
                Logger.Warn($"{nameof(WorkerEventLoop)} failed to create connect request to dispatcher", exception);
                request?.Dispose();
                this.connectCompletion.TryUnwrap(exception);
            }
        }
Пример #3
0
        protected override void Initialize()
        {
            Loop loop = ((ILoopExecutor)this).UnsafeLoop;

            this.PipeHandle = new Pipe(loop, true);
            PipeConnect request = null;

            try
            {
                request = new PipeConnect(this);
            }
            catch (Exception exception)
            {
                Logger.Warn($"{nameof(WorkerEventLoop)} failed to create connect request to dispatcher", exception);
                request?.Dispose();
                this.connectCompletion.TrySetException(exception);
            }
        }
Пример #4
0
        protected override void Initialize()
        {
            Debug.Assert(_pipe is null);

            _pipe = new Pipe(UnsafeLoop, true);
            PipeConnect request = null;

            try
            {
                request = new PipeConnect(this);
            }
            catch (Exception exception)
            {
                if (Logger.WarnEnabled)
                {
                    Logger.FailedToCreateConnectRequestToDispatcher(exception);
                }
                request?.Dispose();
                _ = _connectCompletion.TrySetException(exception);
            }
        }
Пример #5
0
        public static Pipe ConnectTo(this Pipe pipe,
                                     string remoteName,
                                     Action <Pipe, Exception> connectedAction)
        {
            Contract.Requires(pipe != null);
            Contract.Requires(!string.IsNullOrEmpty(remoteName));
            Contract.Requires(connectedAction != null);

            PipeConnect request = null;

            try
            {
                request = new PipeConnect(pipe, remoteName, connectedAction);
            }
            catch (Exception)
            {
                request?.Dispose();
                throw;
            }

            return(pipe);
        }