private MsQuicStream StreamOpen( QUIC_STREAM_OPEN_FLAG flags) { if (NetEventSource.IsEnabled) { NetEventSource.Enter(this); } IntPtr streamPtr = IntPtr.Zero; MsQuicStatusException.ThrowIfFailed( MsQuicApi.Api.StreamOpenDelegate( _ptr, (uint)flags, MsQuicStream.NativeCallbackHandler, IntPtr.Zero, out streamPtr)); MsQuicStream stream = new MsQuicStream(this, flags, streamPtr, inbound: false); if (NetEventSource.IsEnabled) { NetEventSource.Exit(this); } return(stream); }
private void SetParam( QUIC_PARAM_SESSION param, MsQuicNativeMethods.QuicBuffer buf) { MsQuicStatusException.ThrowIfFailed(MsQuicApi.Api.UnsafeSetParam( _nativeObjPtr, (uint)QUIC_PARAM_LEVEL.SESSION, (uint)param, buf)); }
internal override ValueTask ConnectAsync(CancellationToken cancellationToken = default) { ThrowIfDisposed(); MsQuicStatusException.ThrowIfFailed( MsQuicApi.Api.ConnectionStartDelegate( _ptr, (ushort)_remoteEndPoint.AddressFamily, _remoteEndPoint.Address.ToString(), (ushort)_remoteEndPoint.Port)); return(_connectTcs.GetTypelessValueTask()); }
internal override void Start() { ThrowIfDisposed(); SetCallbackHandler(); SOCKADDR_INET address = MsQuicAddressHelpers.IPEndPointToINet(_listenEndPoint); MsQuicStatusException.ThrowIfFailed(MsQuicApi.Api.ListenerStartDelegate( _ptr, ref address)); SetListenPort(); }
private ValueTask ShutdownAsync( QUIC_CONNECTION_SHUTDOWN_FLAG Flags, ushort ErrorCode) { if (NetEventSource.IsEnabled) { NetEventSource.Enter(this); } uint status = MsQuicApi.Api.ConnectionShutdownDelegate( _ptr, (uint)Flags, ErrorCode); MsQuicStatusException.ThrowIfFailed(status); if (NetEventSource.IsEnabled) { NetEventSource.Exit(this); } return(_shutdownTcs.GetTypelessValueTask()); }