public static async Task <IMessageStream> AcceptAsync(Socket acceptedSocket, bool supportsFdPassing) { var socket = new TransportSocket(acceptedSocket, supportsFdPassing); Transport transport = new Transport(socket); socket.SupportsFdPassing = await transport.DoServerAuth(socket.SupportsFdPassing).ConfigureAwait(false); return(transport); }
public static async Task <IMessageStream> ConnectAsync(AddressEntry entry, ClientSetupResult connectionContext, CancellationToken cancellationToken) { TransportSocket socket = await TransportSocket.ConnectAsync(entry, cancellationToken, connectionContext.SupportsFdPassing).ConfigureAwait(false); try { Transport transport = new Transport(socket); await transport.DoClientAuth(entry.Guid, connectionContext.UserId).ConfigureAwait(false); return(transport); } catch { socket.Dispose(); throw; } }
private Transport(TransportSocket socket) { _socket = socket; _sendQueue = new ConcurrentQueue <PendingSend>(); _sendSemaphore = new SemaphoreSlim(1); }