Exemplo n.º 1
0
        /// <summary>
        /// 做pipe的重定向
        /// </summary>
        /// <param name="uvStreamHandle"></param>
        /// <param name="index"></param>
        private void WriteHandleFree(UvStreamHandle uvStreamHandle, int index)
        {
            UvPipeHandle uvPipeHandle = _pipeHandleList[index];
            WriteHandle  writeHandle  = new WriteHandle();

            writeHandle.Init(_loopHandle);
            writeHandle.Free(uvPipeHandle, uvStreamHandle, Write2_CallBack, uvStreamHandle);
        }
Exemplo n.º 2
0
        private void WriteForPost(object state)
        {
            WriteStateForPost writeStateForPost = (WriteStateForPost)state;
            WriteHandle       writeHandle       = new WriteHandle();

            writeHandle.Init(_clientHandle.Loop);
            List <byte[]> buffers = writeStateForPost.Buffers;

            try
            {
                if (buffers.Count == 1)
                {
                    writeHandle.Write(_clientHandle, buffers[0], new Action <int, Exception, object>(WriteCallback), writeStateForPost.WriteObject);
                }
                else if (buffers.Count == 2)
                {
                    writeHandle.Write(_clientHandle, buffers[0], buffers[1], new Action <int, Exception, object>(WriteCallback), writeStateForPost.WriteObject);
                }
            }
            catch (Exception ex)
            {
                WriteCallback(-1, ex, writeStateForPost.WriteObject);
            }
        }