/// <summary>
        /// Returns true if ComAdobeXmpWorkerFilesNcommXMPFilesNCommProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeXmpWorkerFilesNcommXMPFilesNCommProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeXmpWorkerFilesNcommXMPFilesNCommProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     MaxConnections == other.MaxConnections ||
                     MaxConnections != null &&
                     MaxConnections.Equals(other.MaxConnections)
                     ) &&
                 (
                     MaxRequests == other.MaxRequests ||
                     MaxRequests != null &&
                     MaxRequests.Equals(other.MaxRequests)
                 ) &&
                 (
                     RequestTimeout == other.RequestTimeout ||
                     RequestTimeout != null &&
                     RequestTimeout.Equals(other.RequestTimeout)
                 ) &&
                 (
                     LogDir == other.LogDir ||
                     LogDir != null &&
                     LogDir.Equals(other.LogDir)
                 ));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (MaxConnections != null)
         {
             hashCode = hashCode * 59 + MaxConnections.GetHashCode();
         }
         if (MaxRequests != null)
         {
             hashCode = hashCode * 59 + MaxRequests.GetHashCode();
         }
         if (RequestTimeout != null)
         {
             hashCode = hashCode * 59 + RequestTimeout.GetHashCode();
         }
         if (LogDir != null)
         {
             hashCode = hashCode * 59 + LogDir.GetHashCode();
         }
         return(hashCode);
     }
 }
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (Priority != 0)
                    {
                        hash ^= Priority.GetHashCode();
                    }
                    if (maxConnections_ != null)
                    {
                        hash ^= MaxConnections.GetHashCode();
                    }
                    if (maxPendingRequests_ != null)
                    {
                        hash ^= MaxPendingRequests.GetHashCode();
                    }
                    if (maxRequests_ != null)
                    {
                        hash ^= MaxRequests.GetHashCode();
                    }
                    if (maxRetries_ != null)
                    {
                        hash ^= MaxRetries.GetHashCode();
                    }
                    if (_unknownFields != null)
                    {
                        hash ^= _unknownFields.GetHashCode();
                    }
                    return(hash);
                }
Exemple #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Events
            ClientDisconnectEvent.ClientDisconnect += new ClientDisconnectHandler(onClientDisconnect);

            CheckForIllegalCrossThreadCalls = false;

            settings.MainForm   = this;
            _listener           = new List <RatClientListener>();
            _FileListener       = new List <FileClientListener>();
            maxConnections      = new MaxConnections();
            File_maxConnections = new File_MaxConnections();
            ClientPacketProcessor.Initialize();
            FileClientPacketProcessor.Initialize();
        }
Exemple #5
0
        public override string ToString()
        {
            var options = new DictionaryOptions();

            options.Add("RoomName", Name);
            options.Add("RoomIp", RoomIp);
            options.Add("RoomPort", RoomPort);
            options.Add("MaxConnections", MaxConnections <= 0 ? "Unlimited" : MaxConnections.ToString());
            options.Add("Use Password", !string.IsNullOrEmpty(Password));
            options.Add("AccessTimeoutPeriod", $"{AccessTimeoutPeriod} sec.");
            options.Add("AllowUsersRequestAccess", AllowUsersRequestAccess);
            options.Add("Region", string.IsNullOrEmpty(Region) ? "International" : Region);
            options.Append(CustomOptions);

            return(options.ToReadableString());
        }
Exemple #6
0
        private void Disconnect()
        {
            ClientDisconnectEventArgs e1 = new ClientDisconnectEventArgs(_socket.RemoteEndPoint.ToString());

            ClientDisconnectEvent.OnClientDisconnect(e1);

            settings.ClientsConnected--;
            Logger.AddLog(new LogInfo("Client disconnected", _socket.RemoteEndPoint.ToString().Split(':')[0]));

            _socket.Disconnect(false);
            if (DisconnectHandle != null)
            {
                DisconnectHandle(this);
            }
            MaxConnections.Disconnect(_socket.RemoteEndPoint);
        }
        public override int GetHashCode()
        {
            int hashCode = 561235898;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Url);

            hashCode = hashCode * -1521134295 + HasCustomCertificate.GetHashCode();
            hashCode = hashCode * -1521134295 + PendingUpdateCount.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string?> .Default.GetHashCode(IpAddress);

            hashCode = hashCode * -1521134295 + LastErrorDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string?> .Default.GetHashCode(LastErrorMessage);

            hashCode = hashCode * -1521134295 + LastSynchronizationErrorDate.GetHashCode();
            hashCode = hashCode * -1521134295 + MaxConnections.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <IEnumerable <string>?> .Default.GetHashCode(AllowedUpdates);

            return(hashCode);
        }
Exemple #8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (innodbBufferPoolSize_ != null)
            {
                hash ^= InnodbBufferPoolSize.GetHashCode();
            }
            if (maxConnections_ != null)
            {
                hash ^= MaxConnections.GetHashCode();
            }
            if (longQueryTime_ != null)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode(LongQueryTime);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #9
0
        /// <summary>
        /// Returns true if ComAdobeOctopusNcommBootstrapProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeOctopusNcommBootstrapProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeOctopusNcommBootstrapProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     MaxConnections == other.MaxConnections ||
                     MaxConnections != null &&
                     MaxConnections.Equals(other.MaxConnections)
                     ) &&
                 (
                     MaxRequests == other.MaxRequests ||
                     MaxRequests != null &&
                     MaxRequests.Equals(other.MaxRequests)
                 ) &&
                 (
                     RequestTimeout == other.RequestTimeout ||
                     RequestTimeout != null &&
                     RequestTimeout.Equals(other.RequestTimeout)
                 ) &&
                 (
                     RequestRetries == other.RequestRetries ||
                     RequestRetries != null &&
                     RequestRetries.Equals(other.RequestRetries)
                 ) &&
                 (
                     LaunchTimeout == other.LaunchTimeout ||
                     LaunchTimeout != null &&
                     LaunchTimeout.Equals(other.LaunchTimeout)
                 ));
        }
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (Priority != global::Envoy.Api.V3Alpha.Core.RoutingPriority.Default)
                    {
                        hash ^= Priority.GetHashCode();
                    }
                    if (maxConnections_ != null)
                    {
                        hash ^= MaxConnections.GetHashCode();
                    }
                    if (maxPendingRequests_ != null)
                    {
                        hash ^= MaxPendingRequests.GetHashCode();
                    }
                    if (maxRequests_ != null)
                    {
                        hash ^= MaxRequests.GetHashCode();
                    }
                    if (maxRetries_ != null)
                    {
                        hash ^= MaxRetries.GetHashCode();
                    }
                    if (TrackRemaining != false)
                    {
                        hash ^= TrackRemaining.GetHashCode();
                    }
                    if (maxConnectionPools_ != null)
                    {
                        hash ^= MaxConnectionPools.GetHashCode();
                    }
                    if (_unknownFields != null)
                    {
                        hash ^= _unknownFields.GetHashCode();
                    }
                    return(hash);
                }
Exemple #11
0
        public void Initialize()
        {
            // check to see if already initialized
            if (_initialized &&
                _buckets != null &&
                _availPool != null &&
                _busyPool != null)
            {
                if (Log.IsErrorEnabled)
                {
                    Log.Error(GetLocalizedString("initializing initialized pool"));
                }
                return;
            }

            // initialize empty maps
            _buckets          = new ArrayList();
            _availPool        = new Hashtable(_servers.Count * _initConns);
            _busyPool         = new Hashtable(_servers.Count * _initConns);
            _hostDeadDuration = new Hashtable();
            _hostDead         = new Hashtable();
            _createShift      = new Hashtable();
            _maxCreate        = (_poolMultiplier > _minConns) ? _minConns : _minConns / _poolMultiplier;                // only create up to maxCreate connections at once

            if (Log.IsDebugEnabled)
            {
                Log.Debug(GetLocalizedString("initializing pool")
                          .Replace("$$InitConnections$$", InitConnections.ToString(new NumberFormatInfo()))
                          .Replace("$$MinConnections$$", MinConnections.ToString(new NumberFormatInfo()))
                          .Replace("$$MaxConnections$$", MaxConnections.ToString(new NumberFormatInfo())));
            }

            // if servers is not set, or it empty, then
            // throw a runtime exception
            if (_servers == null || _servers.Count <= 0)
            {
                if (Log.IsErrorEnabled)
                {
                    Log.Error(GetLocalizedString("initialize with no servers"));
                }
                throw new ArgumentException(GetLocalizedString("initialize with no servers"));
            }

            for (int i = 0; i < _servers.Count; i++)
            {
                // add to bucket
                // with weights if we have them
                if (_weights != null && _weights.Count > i)
                {
                    for (int k = 0; k < ((int)_weights[i]); k++)
                    {
                        _buckets.Add(_servers[i]);
                        if (Log.IsDebugEnabled)
                        {
                            Log.Debug("Added " + _servers[i] + " to server bucket");
                        }
                    }
                }
                else
                {
                    _buckets.Add(_servers[i]);
                    if (Log.IsDebugEnabled)
                    {
                        Log.Debug("Added " + _servers[i] + " to server bucket");
                    }
                }

                // create initial connections
                if (Log.IsDebugEnabled)
                {
                    Log.Debug(GetLocalizedString("create initial connections").Replace("$$InitConns$$", InitConnections.ToString(new NumberFormatInfo())).Replace("$$Servers[i]$$", Servers[i].ToString()));
                }

                for (int j = 0; j < _initConns; j++)
                {
                    SockIO socket = CreateSocket((string)_servers[i]);
                    if (socket == null)
                    {
                        if (Log.IsErrorEnabled)
                        {
                            Log.Error(GetLocalizedString("failed to connect").Replace("$$Servers[i]$$", Servers[i].ToString()).Replace("$$j$$", j.ToString(new NumberFormatInfo())));
                        }
                        break;
                    }

                    AddSocketToPool(_availPool, (string)_servers[i], socket);
                    if (Log.IsDebugEnabled)
                    {
                        Log.Debug(GetLocalizedString("created and added socket").Replace("$$ToString$$", socket.ToString()).Replace("$$Servers[i]$$", Servers[i].ToString()));
                    }
                }
            }

            // mark pool as initialized
            _initialized = true;

            // start maint thread TODO: re-enable
            if (_maintThreadSleep > 0)
            {
                this.StartMaintenanceThread();
            }
        }
Exemple #12
0
        public override int GetHashCode()
        {
            int hash = 1;

            hash ^= additionalMetricDims_.GetHashCode();
            if (AggregationEnabled != false)
            {
                hash ^= AggregationEnabled.GetHashCode();
            }
            if (AggregationMaxCount != 0UL)
            {
                hash ^= AggregationMaxCount.GetHashCode();
            }
            if (AggregationMaxSize != 0UL)
            {
                hash ^= AggregationMaxSize.GetHashCode();
            }
            if (CloudwatchEndpoint.Length != 0)
            {
                hash ^= CloudwatchEndpoint.GetHashCode();
            }
            if (CloudwatchPort != 0UL)
            {
                hash ^= CloudwatchPort.GetHashCode();
            }
            if (CollectionMaxCount != 0UL)
            {
                hash ^= CollectionMaxCount.GetHashCode();
            }
            if (CollectionMaxSize != 0UL)
            {
                hash ^= CollectionMaxSize.GetHashCode();
            }
            if (ConnectTimeout != 0UL)
            {
                hash ^= ConnectTimeout.GetHashCode();
            }
            if (EnableCoreDumps != false)
            {
                hash ^= EnableCoreDumps.GetHashCode();
            }
            if (FailIfThrottled != false)
            {
                hash ^= FailIfThrottled.GetHashCode();
            }
            if (KinesisEndpoint.Length != 0)
            {
                hash ^= KinesisEndpoint.GetHashCode();
            }
            if (KinesisPort != 0UL)
            {
                hash ^= KinesisPort.GetHashCode();
            }
            if (LogLevel.Length != 0)
            {
                hash ^= LogLevel.GetHashCode();
            }
            if (MaxConnections != 0UL)
            {
                hash ^= MaxConnections.GetHashCode();
            }
            if (MetricsGranularity.Length != 0)
            {
                hash ^= MetricsGranularity.GetHashCode();
            }
            if (MetricsLevel.Length != 0)
            {
                hash ^= MetricsLevel.GetHashCode();
            }
            if (MetricsNamespace.Length != 0)
            {
                hash ^= MetricsNamespace.GetHashCode();
            }
            if (MetricsUploadDelay != 0UL)
            {
                hash ^= MetricsUploadDelay.GetHashCode();
            }
            if (MinConnections != 0UL)
            {
                hash ^= MinConnections.GetHashCode();
            }
            if (RateLimit != 0UL)
            {
                hash ^= RateLimit.GetHashCode();
            }
            if (RecordMaxBufferedTime != 0UL)
            {
                hash ^= RecordMaxBufferedTime.GetHashCode();
            }
            if (RecordTtl != 0UL)
            {
                hash ^= RecordTtl.GetHashCode();
            }
            if (Region.Length != 0)
            {
                hash ^= Region.GetHashCode();
            }
            if (RequestTimeout != 0UL)
            {
                hash ^= RequestTimeout.GetHashCode();
            }
            if (VerifyCertificate != false)
            {
                hash ^= VerifyCertificate.GetHashCode();
            }
            return(hash);
        }