protected internal override unsafe StreamHandle NewStream() { IntPtr loopHandle = ((uv_stream_t *)InternalHandle)->loop; var loop = HandleContext.GetTarget <LoopContext>(loopHandle); var client = new Tcp(loop); NativeMethods.StreamAccept(InternalHandle, client.InternalHandle); client.ReadStart(); #if DEBUG if (Log.DebugEnabled) { Log.Debug("{} {} client {} accepted", HandleType, InternalHandle, client.InternalHandle); } #endif return(client); }
protected internal override unsafe StreamHandle NewStream() { IntPtr loopHandle = ((uv_stream_t *)InternalHandle)->loop; var loop = HandleContext.GetTarget <LoopContext>(loopHandle); uv_handle_type type = ((uv_stream_t *)InternalHandle)->type; StreamHandle client; switch (type) { case uv_handle_type.UV_NAMED_PIPE: client = new Pipe(loop, _ipc); break; case uv_handle_type.UV_TCP: client = new Tcp(loop); break; default: throw ThrowHelper.GetInvalidOperationException_Pipe_IPC_handle_not_supported(type); } NativeMethods.StreamAccept(InternalHandle, client.InternalHandle); if (!_ipc) { client.ReadStart(); } #if DEBUG if (Log.DebugEnabled) { Log.Debug("{} {1} client {} accepted. (IPC : {})", HandleType, InternalHandle, client.InternalHandle, _ipc); } #endif return(client); }