Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
System.Net.WebSockets.WebSocketBase Class Referenceabstract

Classes

interface  IWebSocketStream
 
class  KeepAliveTracker
 
class  OutstandingOperationHelper
 
class  WebSocketOperation
 

Public Member Functions

override Task< WebSocketReceiveResultReceiveAsync (ArraySegment< byte > buffer, CancellationToken cancellationToken)
 
override Task SendAsync (ArraySegment< byte > buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
 
override void Abort ()
 
override Task CloseOutputAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
 
override Task CloseAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
 
override void Dispose ()
 
Task CloseAsync (WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
 
Task CloseOutputAsync (WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
 
virtual async ValueTask< ValueWebSocketReceiveResultReceiveAsync (Memory< byte > buffer, CancellationToken cancellationToken)
 
virtual ValueTask SendAsync (ReadOnlyMemory< byte > buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
 
virtual ValueTask SendAsync (ReadOnlyMemory< byte > buffer, WebSocketMessageType messageType, WebSocketMessageFlags messageFlags, CancellationToken cancellationToken=default(CancellationToken))
 

Static Public Member Functions

static ArraySegment< byte > CreateClientBuffer (int receiveBufferSize, int sendBufferSize)
 
static ArraySegment< byte > CreateServerBuffer (int receiveBufferSize)
 
static WebSocket CreateFromStream (Stream stream, bool isServer, string? subProtocol, TimeSpan keepAliveInterval)
 
static WebSocket CreateFromStream (Stream stream, WebSocketCreationOptions options)
 
static bool IsApplicationTargeting45 ()
 
static void RegisterPrefixes ()
 
static WebSocket CreateClientWebSocket (Stream innerStream, string? subProtocol, int receiveBufferSize, int sendBufferSize, TimeSpan keepAliveInterval, bool useZeroMaskingKey, ArraySegment< byte > internalBuffer)
 

Protected Member Functions

 WebSocketBase (Stream innerStream, string subProtocol, TimeSpan keepAliveInterval, WebSocketBuffer internalBuffer)
 
void StartKeepAliveTimer ()
 

Static Protected Member Functions

static void ThrowOnInvalidState (WebSocketState state, params WebSocketState[] validStates)
 
static bool IsStateTerminal (WebSocketState state)
 

Package Functions

void ValidateNativeBuffers (WebSocketProtocolComponent.Action action, WebSocketProtocolComponent.BufferType bufferType, global::Interop.WebSocket.Buffer[] dataBuffers, uint dataBufferCount)
 

Properties

override WebSocketState State [get]
 
override string SubProtocol [get]
 
override? WebSocketCloseStatus CloseStatus [get]
 
override string CloseStatusDescription [get]
 
WebSocketBuffer InternalBuffer [get]
 
SafeHandle SessionHandle [get]
 
static TimeSpan DefaultKeepAliveInterval [get]
 

Private Member Functions

async Task< WebSocketReceiveResultReceiveAsyncCore (ArraySegment< byte > buffer, CancellationToken cancellationToken)
 
async Task SendAsyncCore (ArraySegment< byte > buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
 
async Task SendFrameAsync (IList< ArraySegment< byte > > sendBuffers, CancellationToken cancellationToken)
 
async Task CloseOutputAsyncCore (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
 
bool OnCloseOutputCompleted ()
 
async Task< boolStartOnCloseCompleted (bool thisLockTakenSnapshot, bool sessionHandleLockTakenSnapshot, CancellationToken cancellationToken)
 
void FinishOnCloseCompleted ()
 
async Task CloseAsyncCore (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
 
void ResetFlagAndTakeLock (object lockObject, ref bool thisLockTaken)
 
void ResetFlagsAndTakeLocks (ref bool thisLockTaken, ref bool sessionHandleLockTaken)
 
void TakeLocks (ref bool thisLockTaken, ref bool sessionHandleLockTaken)
 
void ReleaseLocks (ref bool thisLockTaken, ref bool sessionHandleLockTaken)
 
void EnsureReceiveOperation ()
 
void EnsureSendOperation ()
 
void EnsureKeepAliveOperation ()
 
void EnsureCloseOutputOperation ()
 
void ThrowIfAborted (bool aborted, Exception innerException)
 
bool CanHandleExceptionDuringClose (Exception error)
 
void ThrowIfConvertibleException (string methodName, Exception exception, CancellationToken cancellationToken, bool aborted)
 
void CleanUp ()
 
void OnBackgroundTaskException (Exception exception)
 
void ThrowIfPendingException ()
 
void ThrowIfDisposed ()
 
void UpdateReceiveState (int newReceiveState, int expectedReceiveState)
 
bool StartOnCloseReceived (ref bool thisLockTaken)
 
void FinishOnCloseReceived (WebSocketCloseStatus closeStatus, string closeStatusDescription)
 
async ValueTask SendWithArrayPoolAsync (ReadOnlyMemory< byte > buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
 

Static Private Member Functions

static void ReleaseLock (object lockObject, ref bool lockTaken)
 
static WebSocketProtocolComponent.BufferType GetBufferType (WebSocketMessageType messageType, bool endOfMessage)
 
static WebSocketMessageType GetMessageType (WebSocketProtocolComponent.BufferType bufferType)
 
static async void OnKeepAlive (object sender)
 

Private Attributes

readonly OutstandingOperationHelper _closeOutstandingOperationHelper
 
readonly OutstandingOperationHelper _closeOutputOutstandingOperationHelper
 
readonly OutstandingOperationHelper _receiveOutstandingOperationHelper
 
readonly OutstandingOperationHelper _sendOutstandingOperationHelper
 
readonly Stream _innerStream
 
readonly IWebSocketStream _innerStreamAsWebSocketStream
 
readonly string _subProtocol
 
readonly SemaphoreSlim _sendFrameThrottle
 
readonly object _thisLock
 
readonly WebSocketBuffer _internalBuffer
 
readonly KeepAliveTracker _keepAliveTracker
 
volatile bool _cleanedUp
 
volatile TaskCompletionSource _closeReceivedTaskCompletionSource
 
volatile Task _closeOutputTask
 
volatile bool _isDisposed
 
volatile Task _closeNetworkConnectionTask
 
volatile bool _closeAsyncStartedReceive
 
volatile WebSocketState _state
 
volatile Task _keepAliveTask
 
volatile WebSocketOperation.ReceiveOperation _receiveOperation
 
volatile WebSocketOperation.SendOperation _sendOperation
 
volatile WebSocketOperation.SendOperation _keepAliveOperation
 
volatile WebSocketOperation.CloseOutputOperation _closeOutputOperation
 
WebSocketCloseStatus_closeStatus
 
string _closeStatusDescription
 
int _receiveState
 
Exception _pendingException
 

Detailed Description

Definition at line 13 of file WebSocketBase.cs.


The documentation for this class was generated from the following file: