示例#1
0
 public void Connect()
 {
     if (!this.tcpClient.Connected)
     {
         this.Environment = this.connector.Connect(this, this.tcpClient, this.configuration);
     }
 }
示例#2
0
 public async Task ConnectAsync()
 {
     if (!this.tcpClient.Connected)
     {
         this.Environment = await this.connector.ConnectAsync(this, this.tcpClient, this.configuration);
     }
 }
示例#3
0
        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;
        }
示例#4
0
 public ISonicSession Create(EnvironmentResponse environment)
 {
     return(new SonicSession(this.client, this.semaphore, environment));
 }