Ejemplo n.º 1
0
        internal static SmppInternalConnection GetConnection(SmppSettings Settings)
        {
            SmppPool pool;

            if (Deactivated)
            {
                throw new SmppException("The SmppPoolManager is in process of deactivation");
            }
            if (Pools == null)
            {
                Initialize();
            }
            string connectionString = Settings.ConnectionString;

            lock (Pools.SyncRoot) {
                if (!Pools.Contains(connectionString))
                {
                    pool = new SmppPool(Settings);
                    Pools.Add(connectionString, pool);
                }
                else
                {
                    pool          = Pools[connectionString] as SmppPool;
                    pool.Settings = Settings;
                }
            }
            return(pool.GetConnection());
        }
Ejemplo n.º 2
0
 public SmppShare(SmppSettings Settings) {
   this.Settings = Settings;
   availablePool = new SmppInternalConnection[Settings.Recycling.MaxSize];
   for (int i = 0; i < availablePool.Length; i++)
     availablePool[i] = new SmppInternalConnection(Settings);
   tmCheckIdleConn.AutoReset = false;
   tmCheckIdleConn.Enabled = true;
   tmCheckIdleConn.Elapsed += tmCheckIdleConn_Elapsed;
 }
Ejemplo n.º 3
0
 public SmppShare(SmppSettings Settings)
 {
     this.Settings = Settings;
     availablePool = new SmppInternalConnection[Settings.Recycling.MaxSize];
     for (int i = 0; i < availablePool.Length; i++)
     {
         availablePool[i] = new SmppInternalConnection(Settings);
     }
     tmCheckIdleConn.AutoReset = false;
     tmCheckIdleConn.Enabled   = true;
     tmCheckIdleConn.Elapsed  += tmCheckIdleConn_Elapsed;
 }
Ejemplo n.º 4
0
 public SmppInternalConnection(SmppSettings Settings) {
   TcpConnection = new SockClient();
   PendingResponse = new ListDictionary();
   PendingQueue = new ArrayList(15);
   PendingBind = new ArrayList(10);
   ReleasedDateTime = DateTime.Now;
   LastReceptionTime = DateTime.Now;
   ClientGuid = Guid.NewGuid();
   this.Settings = Settings;
   TcpConnection.DataReceived += TcpConnection_DataReceived;
   TcpConnection.CloseConnection += TcpConnection_CloseConnection;
 }
Ejemplo n.º 5
0
 public SmppInternalConnection(SmppSettings Settings)
 {
     TcpConnection                  = new SockClient();
     PendingResponse                = new ListDictionary();
     PendingQueue                   = new ArrayList(15);
     PendingBind                    = new ArrayList(10);
     ReleasedDateTime               = DateTime.Now;
     LastReceptionTime              = DateTime.Now;
     ClientGuid                     = Guid.NewGuid();
     this.Settings                  = Settings;
     TcpConnection.DataReceived    += TcpConnection_DataReceived;
     TcpConnection.CloseConnection += TcpConnection_CloseConnection;
 }
Ejemplo n.º 6
0
 public SmppPool(SmppSettings Settings) {
   _Settings = Settings;
   inUsePool = new ArrayList();
   idlePool = new ArrayList(Settings.Recycling.MinSize);
   lock (idlePool.SyncRoot) {
     lock (inUsePool.SyncRoot) {
       for (int i = 0; i < Settings.Recycling.MinSize; i++) {
         var connection = new SmppInternalConnection(Settings);
         idlePool.Add(connection);
       }
     }
   }
   tmCheckIdleConn.AutoReset = false;
   tmCheckIdleConn.Enabled = true;
   tmCheckIdleConn.Elapsed += tmCheckIdleConn_Elapsed;
 }
Ejemplo n.º 7
0
 internal static SmppInternalConnection GetConnection(SmppSettings Settings) {
   SmppShare share;
   if (Deactivated)
     throw new SmppException("The SmppPoolManager is in process of deactivation");
   if (Pools == null)
     Initialize();
   string connectionString = Settings.ConnectionString;
   lock (Pools.SyncRoot) {
     if (!Pools.Contains(connectionString)) {
       share = new SmppShare(Settings);
       Pools.Add(connectionString, share);
     } else {
       share = Pools[connectionString] as SmppShare;
       share.Settings = Settings;
     }
   }
   return share.GetConnection();
 }
Ejemplo n.º 8
0
 public SmppPool(SmppSettings Settings)
 {
     _Settings = Settings;
     inUsePool = new ArrayList();
     idlePool  = new ArrayList(Settings.Recycling.MinSize);
     lock (idlePool.SyncRoot) {
         lock (inUsePool.SyncRoot) {
             for (int i = 0; i < Settings.Recycling.MinSize; i++)
             {
                 var connection = new SmppInternalConnection(Settings);
                 idlePool.Add(connection);
             }
         }
     }
     tmCheckIdleConn.AutoReset = false;
     tmCheckIdleConn.Enabled   = true;
     tmCheckIdleConn.Elapsed  += tmCheckIdleConn_Elapsed;
 }
Ejemplo n.º 9
0
 internal static SmppInternalConnection[] GetConnections(SmppSettings Settings) {
   var share = Pools[Settings.ConnectionString] as SmppShare;
   return share.GetConnections();
 }
Ejemplo n.º 10
0
 public SmppConnection(SmppSettings ConnectionSettings) {
   _Settings = ConnectionSettings;
 }
Ejemplo n.º 11
0
 public SmppConnection(SmppSettings ConnectionSettings)
 {
     _Settings = ConnectionSettings;
 }
Ejemplo n.º 12
0
        internal static SmppInternalConnection[] GetConnections(SmppSettings Settings)
        {
            var share = Pools[Settings.ConnectionString] as SmppShare;

            return(share.GetConnections());
        }