public void Connect() { if (!this.tcpClient.Connected) { this.Environment = this.connector.Connect(this, this.tcpClient, this.configuration); } }
public async Task ConnectAsync() { if (!this.tcpClient.Connected) { this.Environment = await this.connector.ConnectAsync(this, this.tcpClient, this.configuration); } }
public SonicSession(ITcpClient client, SemaphoreSlim semaphore, EnvironmentResponse environment) { this.semaphore = semaphore; // As long as the session is alive, it should carry an exclusive lock of the TCP client // to prevent operations across threads. this.semaphore.Wait(); this.Client = client; this.Environment = environment; }
public ISonicSession Create(EnvironmentResponse environment) { return(new SonicSession(this.client, this.semaphore, environment)); }