예제 #1
0
 // Token: 0x060001B8 RID: 440 RVA: 0x00009680 File Offset: 0x00007880
 internal void ReturnToPool(NspiConnection connection)
 {
     lock (this.connections)
     {
         this.connectionsInUse--;
         if (this.connections.Count == 10)
         {
             this.connections[0].Dispose();
             this.connections.RemoveAt(0);
         }
         this.connections.Add(connection);
     }
 }
예제 #2
0
        // Token: 0x060001B7 RID: 439 RVA: 0x000095B4 File Offset: 0x000077B4
        private NspiConnection GetConnectionFromPool()
        {
            NspiConnection nspiConnection = null;
            bool           flag           = false;
            NspiConnection result;

            try
            {
                lock (this.connections)
                {
                    int num = this.connectionsInUse;
                    this.connectionsInUse++;
                    if (this.connections.Count > 0)
                    {
                        int index = this.connections.Count - 1;
                        nspiConnection = this.connections[index];
                        this.connections.RemoveAt(index);
                        flag = true;
                        return(nspiConnection);
                    }
                }
                nspiConnection = new NspiConnection(this);
                if (nspiConnection.Connect() != NspiStatus.Success)
                {
                    result = null;
                }
                else
                {
                    flag   = true;
                    result = nspiConnection;
                }
            }
            finally
            {
                if (!flag && nspiConnection != null)
                {
                    nspiConnection.Dispose();
                    nspiConnection = null;
                }
            }
            return(result);
        }