< Summary

Information
Class: Ice.Internal.Instance
Assembly: Ice
File(s): /home/runner/work/ice/ice/csharp/src/Ice/Internal/Instance.cs
Tag: 71_18251537082
Line coverage
73%
Covered lines: 431
Uncovered lines: 154
Coverable lines: 585
Total lines: 1420
Line coverage: 73.6%
Branch coverage
71%
Covered branches: 199
Total branches: 278
Branch coverage: 71.5%
Method coverage
91%
Covered methods: 53
Total methods: 58
Method coverage: 91.3%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
updateConnectionObservers()100%11100%
updateThreadObservers()100%11100%
initializationData()100%11100%
traceLevels()100%11100%
defaultsAndOverrides()100%11100%
routerManager()50%2.03280%
locatorManager()50%2.03280%
referenceFactory()100%22100%
outgoingConnectionFactory()50%2.03280%
objectAdapterFactory()100%22100%
protocolSupport()100%11100%
preferIPv6()100%11100%
networkProxy()100%11100%
clientThreadPool()100%22100%
serverThreadPool()66.67%6.29680%
endpointHostResolver()50%2.03280%
retryQueue()50%2.03280%
timer()50%2.03280%
endpointFactoryManager()50%2.03280%
pluginManager()50%2.03280%
messageSizeMax()100%11100%
batchAutoFlushSize()100%11100%
classGraphDepthMax()100%11100%
toStringMode()100%11100%
cacheMessageBuffers()100%11100%
getImplicitContext()100%11100%
createAdmin(...)56.25%481650%
getAdmin()80%11.561075%
addAdminFacet(...)90%10.11090%
removeAdminFacet(...)87.5%8.03892.31%
findAdminFacet(...)87.5%8.04891.67%
findAllAdminFacets()87.5%8.05890.91%
setDefaultLocator(...)50%2.02283.33%
setDefaultRouter(...)50%2.02283.33%
setLogger(...)100%11100%
setThreadHook(...)100%210%
addSliceLoader(...)100%210%
initialize(...)68.97%153.165869.53%
finishSetup(...)87.5%61.244882.09%
destroy()69.57%52.874685.19%
getBufSizeWarn(...)0%620%
setSndBufSizeWarn(...)100%210%
setRcvBufSizeWarn(...)100%210%
updateConnectionObservers()100%1.04166.67%
updateThreadObservers()62.5%8.7877.78%
addAllAdminFacets()83.33%6.05688.89%
setServerProcessProxy(...)25%85.731220%
serverConnectionOptions(...)100%11100%
get_sliceLoader()100%11100%
get_clientConnectionOptions()100%11100%
set_clientConnectionOptions(...)100%11100%
get_retryIntervals()100%11100%
set_retryIntervals(...)100%11100%
createNetworkProxy(...)83.33%6.04690%
readConnectionOptions(...)100%11100%
.cctor()100%11100%
.ctor()100%11100%

File(s)

/home/runner/work/ice/ice/csharp/src/Ice/Internal/Instance.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Diagnostics;
 4using System.Globalization;
 5using System.Text;
 6
 7namespace Ice.Internal;
 8
 9public sealed class BufSizeWarnInfo
 10{
 11    // Whether send size warning has been emitted
 12    public bool sndWarn;
 13
 14    // The send size for which the warning was emitted
 15    public int sndSize;
 16
 17    // Whether receive size warning has been emitted
 18    public bool rcvWarn;
 19
 20    // The receive size for which the warning was emitted
 21    public int rcvSize;
 22}
 23
 24public sealed class Instance
 25{
 26    private class ObserverUpdaterI : Ice.Instrumentation.ObserverUpdater
 27    {
 128        public ObserverUpdaterI(Instance instance) => _instance = instance;
 29
 130        public void updateConnectionObservers() => _instance.updateConnectionObservers();
 31
 132        public void updateThreadObservers() => _instance.updateThreadObservers();
 33
 34        private readonly Instance _instance;
 35    }
 36
 37    public Ice.InitializationData initializationData() =>
 38        //
 39        // No check for destruction. It must be possible to access the
 40        // initialization data after destruction.
 41        //
 42        // No mutex lock, immutable.
 43        //
 144        _initData;
 45
 46    public TraceLevels traceLevels()
 47    {
 48        // No mutex lock, immutable.
 49        Debug.Assert(_traceLevels != null);
 150        return _traceLevels;
 51    }
 52
 53    public DefaultsAndOverrides defaultsAndOverrides()
 54    {
 55        // No mutex lock, immutable.
 56        Debug.Assert(_defaultsAndOverrides != null);
 157        return _defaultsAndOverrides;
 58    }
 59
 60    public RouterManager routerManager()
 61    {
 162        lock (_mutex)
 63        {
 164            if (_state == StateDestroyed)
 65            {
 066                throw new Ice.CommunicatorDestroyedException();
 67            }
 68
 69            Debug.Assert(_routerManager != null);
 170            return _routerManager;
 71        }
 172    }
 73
 74    public LocatorManager locatorManager()
 75    {
 176        lock (_mutex)
 77        {
 178            if (_state == StateDestroyed)
 79            {
 080                throw new Ice.CommunicatorDestroyedException();
 81            }
 82
 83            Debug.Assert(_locatorManager != null);
 184            return _locatorManager;
 85        }
 186    }
 87
 88    internal ReferenceFactory referenceFactory()
 89    {
 190        lock (_mutex)
 91        {
 192            if (_state == StateDestroyed)
 93            {
 194                throw new Ice.CommunicatorDestroyedException();
 95            }
 96
 97            Debug.Assert(_referenceFactory != null);
 198            return _referenceFactory;
 99        }
 1100    }
 101
 102    internal OutgoingConnectionFactory outgoingConnectionFactory()
 103    {
 1104        lock (_mutex)
 105        {
 1106            if (_state == StateDestroyed)
 107            {
 0108                throw new Ice.CommunicatorDestroyedException();
 109            }
 110
 111            Debug.Assert(_outgoingConnectionFactory != null);
 1112            return _outgoingConnectionFactory;
 113        }
 1114    }
 115
 116    public ObjectAdapterFactory objectAdapterFactory()
 117    {
 1118        lock (_mutex)
 119        {
 1120            if (_state == StateDestroyed)
 121            {
 1122                throw new Ice.CommunicatorDestroyedException();
 123            }
 124
 125            Debug.Assert(_objectAdapterFactory != null);
 1126            return _objectAdapterFactory;
 127        }
 1128    }
 129
 1130    public int protocolSupport() => _protocolSupport;
 131
 1132    public bool preferIPv6() => _preferIPv6;
 133
 1134    public NetworkProxy networkProxy() => _networkProxy;
 135
 136    public ThreadPool clientThreadPool()
 137    {
 1138        lock (_mutex)
 139        {
 1140            if (_state == StateDestroyed)
 141            {
 1142                throw new Ice.CommunicatorDestroyedException();
 143            }
 144
 145            Debug.Assert(_clientThreadPool != null);
 1146            return _clientThreadPool;
 147        }
 1148    }
 149
 150    public ThreadPool serverThreadPool()
 151    {
 1152        lock (_mutex)
 153        {
 1154            if (_state == StateDestroyed)
 155            {
 0156                throw new Ice.CommunicatorDestroyedException();
 157            }
 158
 1159            if (_serverThreadPool == null) // Lazy initialization.
 160            {
 1161                if (_state == StateDestroyInProgress)
 162                {
 0163                    throw new Ice.CommunicatorDestroyedException();
 164                }
 1165                int timeout = _initData.properties.getIcePropertyAsInt("Ice.ServerIdleTime");
 1166                _serverThreadPool = new ThreadPool(this, "Ice.ThreadPool.Server", timeout);
 167            }
 168
 1169            return _serverThreadPool;
 170        }
 1171    }
 172
 173    public EndpointHostResolver endpointHostResolver()
 174    {
 1175        lock (_mutex)
 176        {
 1177            if (_state == StateDestroyed)
 178            {
 0179                throw new Ice.CommunicatorDestroyedException();
 180            }
 181
 182            Debug.Assert(_endpointHostResolver != null);
 1183            return _endpointHostResolver;
 184        }
 1185    }
 186
 187    public RetryQueue
 188    retryQueue()
 189    {
 1190        lock (_mutex)
 191        {
 1192            if (_state == StateDestroyed)
 193            {
 0194                throw new Ice.CommunicatorDestroyedException();
 195            }
 196
 197            Debug.Assert(_retryQueue != null);
 1198            return _retryQueue;
 199        }
 1200    }
 201
 202    public Timer
 203    timer()
 204    {
 1205        lock (_mutex)
 206        {
 1207            if (_state == StateDestroyed)
 208            {
 0209                throw new Ice.CommunicatorDestroyedException();
 210            }
 211
 212            Debug.Assert(_timer != null);
 1213            return _timer;
 214        }
 1215    }
 216
 217    public EndpointFactoryManager endpointFactoryManager()
 218    {
 1219        lock (_mutex)
 220        {
 1221            if (_state == StateDestroyed)
 222            {
 0223                throw new Ice.CommunicatorDestroyedException();
 224            }
 225
 226            Debug.Assert(_endpointFactoryManager != null);
 1227            return _endpointFactoryManager;
 228        }
 1229    }
 230
 231    public Ice.PluginManager pluginManager()
 232    {
 1233        lock (_mutex)
 234        {
 1235            if (_state == StateDestroyed)
 236            {
 0237                throw new Ice.CommunicatorDestroyedException();
 238            }
 239
 240            Debug.Assert(_pluginManager != null);
 1241            return _pluginManager;
 242        }
 1243    }
 244
 245    public int messageSizeMax() =>
 246        // No mutex lock, immutable.
 1247        _messageSizeMax;
 248
 249    public int batchAutoFlushSize() =>
 250        // No mutex lock, immutable.
 1251        _batchAutoFlushSize;
 252
 253    public int classGraphDepthMax() =>
 254        // No mutex lock, immutable.
 1255        _classGraphDepthMax;
 256
 257    public Ice.ToStringMode
 258    toStringMode() =>
 259        // No mutex lock, immutable
 1260        _toStringMode;
 261
 262    public int cacheMessageBuffers() =>
 263        // No mutex lock, immutable.
 1264        _cacheMessageBuffers;
 265
 1266    public Ice.ImplicitContextI getImplicitContext() => _implicitContext;
 267
 268    public Ice.ObjectPrx createAdmin(Ice.ObjectAdapter adminAdapter, Ice.Identity adminIdentity)
 269    {
 1270        bool createAdapter = adminAdapter == null;
 271
 1272        lock (_mutex)
 273        {
 1274            if (_state == StateDestroyed)
 275            {
 0276                throw new Ice.CommunicatorDestroyedException();
 277            }
 278
 1279            if (adminIdentity == null || adminIdentity.name.Length == 0)
 280            {
 0281                throw new ArgumentException("The admin identity is not valid", nameof(adminIdentity));
 282            }
 283
 1284            if (_adminAdapter != null)
 285            {
 0286                throw new Ice.InitializationException("Admin already created");
 287            }
 288
 1289            if (!_adminEnabled)
 290            {
 0291                throw new Ice.InitializationException("Admin is disabled");
 292            }
 293
 1294            if (createAdapter)
 295            {
 1296                if (_initData.properties.getIceProperty("Ice.Admin.Endpoints").Length > 0)
 297                {
 0298                    adminAdapter = _objectAdapterFactory.createObjectAdapter(
 0299                        "Ice.Admin",
 0300                        router: null,
 0301                        serverAuthenticationOptions: null);
 302                }
 303                else
 304                {
 1305                    throw new Ice.InitializationException("Ice.Admin.Endpoints is not set");
 306                }
 307            }
 308
 1309            _adminIdentity = adminIdentity;
 1310            _adminAdapter = adminAdapter;
 1311            addAllAdminFacets();
 1312        }
 313
 1314        if (createAdapter)
 315        {
 316            try
 317            {
 0318                adminAdapter.activate();
 0319            }
 0320            catch (Ice.LocalException)
 321            {
 322                //
 323                // We cleanup _adminAdapter, however this error is not recoverable
 324                // (can't call again getAdmin() after fixing the problem)
 325                // since all the facets (servants) in the adapter are lost
 326                //
 0327                adminAdapter.destroy();
 0328                lock (_mutex)
 329                {
 0330                    _adminAdapter = null;
 0331                }
 0332                throw;
 333            }
 334        }
 1335        setServerProcessProxy(adminAdapter, adminIdentity);
 1336        return adminAdapter.createProxy(adminIdentity);
 337    }
 338
 339    public Ice.ObjectPrx
 340    getAdmin()
 341    {
 342        Ice.ObjectAdapter adminAdapter;
 343        Ice.Identity adminIdentity;
 344
 1345        lock (_mutex)
 346        {
 1347            if (_state == StateDestroyed)
 348            {
 0349                throw new Ice.CommunicatorDestroyedException();
 350            }
 351
 1352            if (_adminAdapter != null)
 353            {
 1354                return _adminAdapter.createProxy(_adminIdentity);
 355            }
 1356            else if (_adminEnabled)
 357            {
 1358                if (_initData.properties.getIceProperty("Ice.Admin.Endpoints").Length > 0)
 359                {
 1360                    adminAdapter = _objectAdapterFactory.createObjectAdapter(
 1361                        "Ice.Admin",
 1362                        router: null,
 1363                        serverAuthenticationOptions: null);
 364                }
 365                else
 366                {
 1367                    return null;
 368                }
 1369                adminIdentity = new Ice.Identity(
 1370                    "admin",
 1371                    _initData.properties.getIceProperty("Ice.Admin.InstanceName"));
 1372                if (adminIdentity.category.Length == 0)
 373                {
 0374                    adminIdentity.category = System.Guid.NewGuid().ToString();
 375                }
 376
 1377                _adminIdentity = adminIdentity;
 1378                _adminAdapter = adminAdapter;
 1379                addAllAdminFacets();
 380                // continue below outside synchronization
 381            }
 382            else
 383            {
 1384                return null;
 385            }
 386        }
 387
 388        try
 389        {
 1390            adminAdapter.activate();
 1391        }
 0392        catch (Ice.LocalException)
 393        {
 394            //
 395            // We cleanup _adminAdapter, however this error is not recoverable
 396            // (can't call again getAdmin() after fixing the problem)
 397            // since all the facets (servants) in the adapter are lost
 398            //
 0399            adminAdapter.destroy();
 0400            lock (_mutex)
 401            {
 0402                _adminAdapter = null;
 0403            }
 0404            throw;
 405        }
 406
 1407        setServerProcessProxy(adminAdapter, adminIdentity);
 1408        return adminAdapter.createProxy(adminIdentity);
 1409    }
 410
 411    public void
 412    addAdminFacet(Ice.Object servant, string facet)
 413    {
 1414        lock (_mutex)
 415        {
 1416            if (_state == StateDestroyed)
 417            {
 0418                throw new Ice.CommunicatorDestroyedException();
 419            }
 420
 1421            if (_adminAdapter == null || (_adminFacetFilter.Count > 0 && !_adminFacetFilter.Contains(facet)))
 422            {
 1423                if (_adminFacets.ContainsKey(facet))
 424                {
 1425                    throw new Ice.AlreadyRegisteredException("facet", facet);
 426                }
 1427                _adminFacets.Add(facet, servant);
 428            }
 429            else
 430            {
 1431                _adminAdapter.addFacet(servant, _adminIdentity, facet);
 432            }
 1433        }
 1434    }
 435
 436    public Ice.Object
 437    removeAdminFacet(string facet)
 438    {
 1439        lock (_mutex)
 440        {
 1441            if (_state == StateDestroyed)
 442            {
 0443                throw new Ice.CommunicatorDestroyedException();
 444            }
 445
 1446            Ice.Object result = null;
 1447            if (_adminAdapter == null || (_adminFacetFilter.Count > 0 && !_adminFacetFilter.Contains(facet)))
 448            {
 449                try
 450                {
 1451                    result = _adminFacets[facet];
 1452                }
 1453                catch (KeyNotFoundException)
 454                {
 1455                    throw new Ice.NotRegisteredException("facet", facet);
 456                }
 457
 1458                _adminFacets.Remove(facet);
 459            }
 460            else
 461            {
 1462                result = _adminAdapter.removeFacet(_adminIdentity, facet);
 463            }
 1464            return result;
 465        }
 1466    }
 467
 468    public Ice.Object
 469    findAdminFacet(string facet)
 470    {
 1471        lock (_mutex)
 472        {
 1473            if (_state == StateDestroyed)
 474            {
 0475                throw new Ice.CommunicatorDestroyedException();
 476            }
 477
 1478            Ice.Object result = null;
 1479            if (_adminAdapter == null || (_adminFacetFilter.Count > 0 && !_adminFacetFilter.Contains(facet)))
 480            {
 481                try
 482                {
 1483                    result = _adminFacets[facet];
 1484                }
 1485                catch (KeyNotFoundException)
 486                {
 1487                }
 488            }
 489            else
 490            {
 1491                result = _adminAdapter.findFacet(_adminIdentity, facet);
 492            }
 1493            return result;
 494        }
 1495    }
 496
 497    public Dictionary<string, Ice.Object>
 498    findAllAdminFacets()
 499    {
 1500        lock (_mutex)
 501        {
 1502            if (_state == StateDestroyed)
 503            {
 0504                throw new Ice.CommunicatorDestroyedException();
 505            }
 506
 1507            if (_adminAdapter == null)
 508            {
 1509                return new Dictionary<string, Ice.Object>(_adminFacets);
 510            }
 511            else
 512            {
 1513                Dictionary<string, Ice.Object> result = _adminAdapter.findAllFacets(_adminIdentity);
 1514                if (_adminFacets.Count > 0)
 515                {
 1516                    foreach (KeyValuePair<string, Ice.Object> p in _adminFacets)
 517                    {
 1518                        result.Add(p.Key, p.Value);
 519                    }
 520                }
 1521                return result;
 522            }
 523        }
 1524    }
 525
 526    public void
 527    setDefaultLocator(Ice.LocatorPrx locator)
 528    {
 1529        lock (_mutex)
 530        {
 1531            if (_state == StateDestroyed)
 532            {
 0533                throw new Ice.CommunicatorDestroyedException();
 534            }
 535
 1536            _referenceFactory = _referenceFactory.setDefaultLocator(locator);
 1537        }
 1538    }
 539
 540    public void
 541    setDefaultRouter(Ice.RouterPrx router)
 542    {
 1543        lock (_mutex)
 544        {
 1545            if (_state == StateDestroyed)
 546            {
 0547                throw new Ice.CommunicatorDestroyedException();
 548            }
 549
 1550            _referenceFactory = _referenceFactory.setDefaultRouter(router);
 1551        }
 1552    }
 553
 554    public void
 555    setLogger(Ice.Logger logger) =>
 556        //
 557        // No locking, as it can only be called during plug-in loading
 558        //
 1559        _initData.logger = logger;
 560
 561    public void
 562    setThreadHook(System.Action threadStart, System.Action threadStop)
 563    {
 564        //
 565        // No locking, as it can only be called during plug-in loading
 566        //
 0567        _initData.threadStart = threadStart;
 0568        _initData.threadStop = threadStop;
 0569    }
 570
 0571    internal void addSliceLoader(SliceLoader loader) => _applicationSliceLoader.add(loader);
 572
 573    //
 574    // Only for use by Ice.Communicator
 575    //
 576    internal void initialize(Ice.Communicator communicator, Ice.InitializationData initData)
 577    {
 1578        _state = StateActive;
 1579        _initData = initData;
 580
 581        try
 582        {
 1583            _initData.properties ??= new Ice.Properties();
 584
 1585            lock (_staticLock)
 586            {
 1587                if (!_oneOffDone)
 588                {
 1589                    string stdOut = _initData.properties.getIceProperty("Ice.StdOut");
 1590                    string stdErr = _initData.properties.getIceProperty("Ice.StdErr");
 591
 1592                    System.IO.StreamWriter outStream = null;
 593
 1594                    if (stdOut.Length > 0)
 595                    {
 596                        try
 597                        {
 0598                            outStream = System.IO.File.AppendText(stdOut);
 0599                        }
 0600                        catch (IOException ex)
 601                        {
 0602                            throw new FileException($"Cannot append to '{stdOut}'", ex);
 603                        }
 0604                        outStream.AutoFlush = true;
 0605                        Console.Out.Close();
 0606                        Console.SetOut(outStream);
 607                    }
 1608                    if (stdErr.Length > 0)
 609                    {
 0610                        if (stdErr.Equals(stdOut, StringComparison.Ordinal))
 611                        {
 0612                            Console.SetError(outStream);
 613                        }
 614                        else
 615                        {
 0616                            System.IO.StreamWriter errStream = null;
 617                            try
 618                            {
 0619                                errStream = System.IO.File.AppendText(stdErr);
 0620                            }
 0621                            catch (IOException ex)
 622                            {
 0623                                throw new FileException($"Cannot append to '{stdErr}'", ex);
 624                            }
 0625                            errStream.AutoFlush = true;
 0626                            Console.Error.Close();
 0627                            Console.SetError(errStream);
 628                        }
 629                    }
 630
 1631                    _oneOffDone = true;
 632                }
 1633            }
 634
 1635            if (_initData.logger == null)
 636            {
 1637                string logfile = _initData.properties.getIceProperty("Ice.LogFile");
 1638                if (logfile.Length != 0)
 639                {
 1640                    _initData.logger =
 1641                        new Ice.FileLoggerI(_initData.properties.getIceProperty("Ice.ProgramName"), logfile);
 642                }
 1643                else if (Ice.Util.getProcessLogger() is Ice.LoggerI)
 644                {
 645                    //
 646                    // Ice.ConsoleListener is enabled by default.
 647                    //
 1648                    bool console = _initData.properties.getIcePropertyAsInt("Ice.ConsoleListener") > 0;
 1649                    _initData.logger =
 1650                        new Ice.TraceLoggerI(_initData.properties.getIceProperty("Ice.ProgramName"), console);
 651                }
 652                else
 653                {
 0654                    _initData.logger = Ice.Util.getProcessLogger();
 655                }
 656            }
 657
 1658            _traceLevels = new TraceLevels(_initData.properties);
 659
 1660            _defaultsAndOverrides = new DefaultsAndOverrides(_initData.properties, _initData.logger);
 661
 1662            clientConnectionOptions = readConnectionOptions("Ice.Connection.Client");
 1663            _serverConnectionOptions = readConnectionOptions("Ice.Connection.Server");
 664
 665            // The maximum size of an Ice protocol message in bytes. This is limited to 0x7fffffff, which corresponds to
 666            // the maximum value of a 32-bit signed integer (int).
 667            const int messageSizeMaxUpperLimit = int.MaxValue;
 1668            int messageSizeMax = _initData.properties.getIcePropertyAsInt("Ice.MessageSizeMax");
 1669            if (messageSizeMax > messageSizeMaxUpperLimit / 1024)
 670            {
 0671                throw new Ice.InitializationException(
 0672                    $"Ice.MessageSizeMax '{messageSizeMax}' is too large, it must be less than or equal to '{messageSize
 673            }
 1674            else if (messageSizeMax < 1)
 675            {
 0676                _messageSizeMax = messageSizeMaxUpperLimit;
 677            }
 678            else
 679            {
 680                // The property is specified in kibibytes (KiB); _messageSizeMax is stored in bytes.
 1681                _messageSizeMax = messageSizeMax * 1024;
 682            }
 683
 1684            int batchAutoFlushSize = _initData.properties.getIcePropertyAsInt("Ice.BatchAutoFlushSize");
 1685            if (batchAutoFlushSize > messageSizeMaxUpperLimit / 1024)
 686            {
 0687                throw new Ice.InitializationException(
 0688                    $"Ice.BatchAutoFlushSize '{batchAutoFlushSize}' is too large, it must be less than or equal to '{mes
 689            }
 1690            else if (batchAutoFlushSize < 1)
 691            {
 0692                _batchAutoFlushSize = messageSizeMaxUpperLimit;
 693            }
 694            else
 695            {
 696                // The property is specified in kibibytes (KiB); _batchAutoFlushSize is stored in bytes.
 1697                _batchAutoFlushSize = batchAutoFlushSize * 1024;
 698            }
 699
 1700            int classGraphDepthMax = _initData.properties.getIcePropertyAsInt("Ice.ClassGraphDepthMax");
 1701            if (classGraphDepthMax < 1)
 702            {
 0703                _classGraphDepthMax = 0x7fffffff;
 704            }
 705            else
 706            {
 1707                _classGraphDepthMax = classGraphDepthMax;
 708            }
 709
 710            // Update _initData.sliceLoader
 711
 1712            if (_initData.sliceLoader is not null)
 713            {
 1714                _applicationSliceLoader.add(_initData.sliceLoader);
 715            }
 716
 717            // We create a lazy Slice loader that searches assemblies the first time we unmarshal a class or
 718            // exception. At that time, all the assemblies should have been loaded.
 1719            var lazySliceLoader = new LazySliceLoader(
 1720                () => SliceLoader.fromAssemblies(AppDomain.CurrentDomain.GetAssemblies()));
 721
 1722            _initData.sliceLoader = new CompositeSliceLoader(_applicationSliceLoader, lazySliceLoader);
 723
 1724            string toStringModeStr = _initData.properties.getIceProperty("Ice.ToStringMode");
 1725            if (toStringModeStr == "Unicode")
 726            {
 1727                _toStringMode = Ice.ToStringMode.Unicode;
 728            }
 0729            else if (toStringModeStr == "ASCII")
 730            {
 0731                _toStringMode = Ice.ToStringMode.ASCII;
 732            }
 0733            else if (toStringModeStr == "Compat")
 734            {
 0735                _toStringMode = Ice.ToStringMode.Compat;
 736            }
 737            else
 738            {
 0739                throw new Ice.InitializationException(
 0740                    "The value for Ice.ToStringMode must be Unicode, ASCII or Compat");
 741            }
 742
 1743            _cacheMessageBuffers = _initData.properties.getIcePropertyAsInt("Ice.CacheMessageBuffers");
 744
 1745            _implicitContext = Ice.ImplicitContextI.create(_initData.properties.getIceProperty("Ice.ImplicitContext"));
 1746            _routerManager = new RouterManager();
 747
 1748            _locatorManager = new LocatorManager(_initData.properties);
 749
 1750            _referenceFactory = new ReferenceFactory(this, communicator);
 751
 1752            bool isIPv6Supported = Network.isIPv6Supported();
 1753            bool ipv4 = _initData.properties.getIcePropertyAsInt("Ice.IPv4") > 0;
 1754            bool ipv6 = isIPv6Supported && _initData.properties.getIcePropertyAsInt("Ice.IPv6") > 0;
 1755            if (!ipv4 && !ipv6)
 756            {
 0757                throw new Ice.InitializationException("Both IPV4 and IPv6 support cannot be disabled.");
 758            }
 1759            else if (ipv4 && ipv6)
 760            {
 1761                _protocolSupport = Network.EnableBoth;
 762            }
 1763            else if (ipv4)
 764            {
 1765                _protocolSupport = Network.EnableIPv4;
 766            }
 767            else
 768            {
 1769                _protocolSupport = Network.EnableIPv6;
 770            }
 1771            _preferIPv6 = _initData.properties.getIcePropertyAsInt("Ice.PreferIPv6Address") > 0;
 772
 1773            _networkProxy = createNetworkProxy(_initData.properties, _protocolSupport);
 774
 1775            _sslEngine = new Ice.SSL.SSLEngine(communicator);
 776
 1777            _endpointFactoryManager = new EndpointFactoryManager(this);
 778
 1779            var tcpInstance = new ProtocolInstance(this, Ice.TCPEndpointType.value, "tcp", false);
 1780            _endpointFactoryManager.add(new TcpEndpointFactory(tcpInstance));
 781
 1782            var udpInstance = new ProtocolInstance(this, Ice.UDPEndpointType.value, "udp", false);
 1783            _endpointFactoryManager.add(new UdpEndpointFactory(udpInstance));
 784
 1785            var wsInstance = new ProtocolInstance(this, Ice.WSEndpointType.value, "ws", false);
 1786            _endpointFactoryManager.add(new WSEndpointFactory(wsInstance, Ice.TCPEndpointType.value));
 787
 1788            var sslInstance = new Ice.SSL.Instance(_sslEngine, Ice.SSLEndpointType.value, "ssl");
 1789            _endpointFactoryManager.add(new Ice.SSL.EndpointFactoryI(sslInstance, Ice.TCPEndpointType.value));
 790
 1791            var wssInstance = new ProtocolInstance(this, Ice.WSSEndpointType.value, "wss", true);
 1792            _endpointFactoryManager.add(new WSEndpointFactory(wssInstance, Ice.SSLEndpointType.value));
 793
 1794            _pluginManager = new Ice.PluginManagerI(communicator);
 795
 1796            _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
 797
 1798            _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
 799
 1800            _retryQueue = new RetryQueue(this);
 801
 1802            string[] retryValues = _initData.properties.getIcePropertyAsList("Ice.RetryIntervals");
 1803            if (retryValues.Length == 0)
 804            {
 0805                retryIntervals = [0];
 806            }
 807            else
 808            {
 1809                retryIntervals = new int[retryValues.Length];
 810
 1811                for (int i = 0; i < retryValues.Length; i++)
 812                {
 813                    int v;
 814
 815                    try
 816                    {
 1817                        v = int.Parse(retryValues[i], CultureInfo.InvariantCulture);
 1818                    }
 0819                    catch (System.FormatException)
 820                    {
 0821                        v = 0;
 0822                    }
 823
 824                    //
 825                    // If -1 is the first value, no retry and wait intervals.
 826                    //
 1827                    if (i == 0 && v == -1)
 828                    {
 1829                        retryIntervals = [];
 1830                        break;
 831                    }
 832
 1833                    retryIntervals[i] = v > 0 ? v : 0;
 834                }
 835            }
 836
 1837            if (_initData.properties.getIcePropertyAsInt("Ice.PreloadAssemblies") > 0)
 838            {
 1839                AssemblyUtil.preloadAssemblies();
 840            }
 1841        }
 0842        catch (Ice.LocalException)
 843        {
 0844            destroy();
 0845            throw;
 846        }
 1847    }
 848
 849    internal void finishSetup(Communicator communicator)
 850    {
 851        //
 852        // Load plug-ins.
 853        //
 854        Debug.Assert(_serverThreadPool == null);
 1855        var pluginManagerImpl = (Ice.PluginManagerI)_pluginManager;
 1856        pluginManagerImpl.loadPlugins();
 857
 858        //
 859        // Initialize the endpoint factories once all the plugins are loaded. This gives
 860        // the opportunity for the endpoint factories to find underlying factories.
 861        //
 1862        _endpointFactoryManager.initialize();
 863
 864        //
 865        // Create Admin facets, if enabled.
 866        //
 867        // Note that any logger-dependent admin facet must be created after we load all plugins,
 868        // since one of these plugins can be a Logger plugin that sets a new logger during loading
 869        //
 870
 1871        if (_initData.properties.getIceProperty("Ice.Admin.Enabled").Length == 0)
 872        {
 1873            _adminEnabled = _initData.properties.getIceProperty("Ice.Admin.Endpoints").Length > 0;
 874        }
 875        else
 876        {
 1877            _adminEnabled = _initData.properties.getIcePropertyAsInt("Ice.Admin.Enabled") > 0;
 878        }
 879
 1880        string[] facetFilter = _initData.properties.getIcePropertyAsList("Ice.Admin.Facets");
 1881        if (facetFilter.Length > 0)
 882        {
 1883            foreach (string s in facetFilter)
 884            {
 1885                _adminFacetFilter.Add(s);
 886            }
 887        }
 888
 1889        if (_adminEnabled)
 890        {
 891            //
 892            // Process facet
 893            //
 1894            string processFacetName = "Process";
 1895            if (_adminFacetFilter.Count == 0 || _adminFacetFilter.Contains(processFacetName))
 896            {
 1897                _adminFacets.Add(processFacetName, new ProcessI(communicator));
 898            }
 899
 900            //
 901            // Logger facet
 902            //
 1903            string loggerFacetName = "Logger";
 1904            if (_adminFacetFilter.Count == 0 || _adminFacetFilter.Contains(loggerFacetName))
 905            {
 1906                LoggerAdminLogger logger = new LoggerAdminLoggerI(_initData.properties, _initData.logger);
 1907                setLogger(logger);
 1908                _adminFacets.Add(loggerFacetName, logger.getFacet());
 909            }
 910
 911            //
 912            // Properties facet
 913            //
 1914            string propertiesFacetName = "Properties";
 1915            NativePropertiesAdmin propsAdmin = null;
 1916            if (_adminFacetFilter.Count == 0 || _adminFacetFilter.Contains(propertiesFacetName))
 917            {
 1918                propsAdmin = new NativePropertiesAdmin(this);
 1919                _adminFacets.Add(propertiesFacetName, propsAdmin);
 920            }
 921
 922            //
 923            // Metrics facet
 924            //
 1925            string metricsFacetName = "Metrics";
 1926            if (_adminFacetFilter.Count == 0 || _adminFacetFilter.Contains(metricsFacetName))
 927            {
 1928                var observer = new CommunicatorObserverI(_initData);
 1929                _initData.observer = observer;
 1930                _adminFacets.Add(metricsFacetName, observer.getFacet());
 931
 932                //
 933                // Make sure the admin plugin receives property updates.
 934                //
 1935                propsAdmin?.addUpdateCallback(observer.getFacet().updated);
 936            }
 937        }
 938
 939        //
 940        // Set observer updater
 941        //
 1942        _initData.observer?.setObserverUpdater(new ObserverUpdaterI(this));
 943
 944        //
 945        // Create threads.
 946        //
 947        try
 948        {
 1949            _timer = new Timer(this, Util.stringToThreadPriority(
 1950                                            initializationData().properties.getIceProperty("Ice.ThreadPriority")));
 1951        }
 0952        catch (System.Exception ex)
 953        {
 0954            string s = "cannot create thread for timer:\n" + ex;
 0955            _initData.logger.error(s);
 0956            throw;
 957        }
 958
 959        try
 960        {
 1961            _endpointHostResolver = new EndpointHostResolver(this);
 1962        }
 0963        catch (System.Exception ex)
 964        {
 0965            string s = "cannot create thread for endpoint host resolver:\n" + ex;
 0966            _initData.logger.error(s);
 0967            throw;
 968        }
 1969        _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0);
 970
 971        //
 972        // The default router/locator may have been set during the loading of plugins.
 973        // Therefore we make sure it is not already set before checking the property.
 974        //
 1975        if (_referenceFactory.getDefaultRouter() == null)
 976        {
 1977            Ice.RouterPrx r = Ice.RouterPrxHelper.uncheckedCast(
 1978                communicator.propertyToProxy("Ice.Default.Router"));
 1979            if (r != null)
 980            {
 0981                _referenceFactory = _referenceFactory.setDefaultRouter(r);
 982            }
 983        }
 984
 1985        if (_referenceFactory.getDefaultLocator() == null)
 986        {
 1987            Ice.LocatorPrx l = Ice.LocatorPrxHelper.uncheckedCast(
 1988                communicator.propertyToProxy("Ice.Default.Locator"));
 1989            if (l != null)
 990            {
 1991                _referenceFactory = _referenceFactory.setDefaultLocator(l);
 992            }
 993        }
 994
 995        //
 996        // Show process id if requested (but only once).
 997        //
 1998        lock (_mutex)
 999        {
 11000            if (!_printProcessIdDone && _initData.properties.getIcePropertyAsInt("Ice.PrintProcessId") > 0)
 1001            {
 01002                using var p = System.Diagnostics.Process.GetCurrentProcess();
 01003                Console.WriteLine(p.Id);
 01004                _printProcessIdDone = true;
 1005            }
 11006        }
 1007
 1008        // SslEngine initialization
 11009        _sslEngine.initialize();
 1010
 1011        //
 1012        // Server thread pool initialization is lazy in serverThreadPool().
 1013        //
 1014
 1015        //
 1016        // An application can set Ice.InitPlugins=0 if it wants to postpone
 1017        // initialization until after it has interacted directly with the
 1018        // plug-ins.
 1019        //
 11020        if (_initData.properties.getIcePropertyAsInt("Ice.InitPlugins") > 0)
 1021        {
 11022            pluginManagerImpl.initializePlugins();
 1023        }
 1024
 1025        //
 1026        // This must be done last as this call creates the Ice.Admin object adapter
 1027        // and eventually registers a process proxy with the Ice locator (allowing
 1028        // remote clients to invoke on Ice.Admin facets as soon as it's registered).
 1029        //
 11030        if (_initData.properties.getIcePropertyAsInt("Ice.Admin.DelayCreation") <= 0)
 1031        {
 11032            getAdmin();
 1033        }
 11034    }
 1035
 1036    //
 1037    // Only for use by Ice.Communicator
 1038    //
 1039    public void destroy()
 1040    {
 11041        lock (_mutex)
 1042        {
 1043            //
 1044            // If destroy is in progress, wait for it to be done. This
 1045            // is necessary in case destroy() is called concurrently
 1046            // by multiple threads.
 1047            //
 11048            while (_state == StateDestroyInProgress)
 1049            {
 01050                Monitor.Wait(_mutex);
 1051            }
 1052
 11053            if (_state == StateDestroyed)
 1054            {
 11055                return;
 1056            }
 11057            _state = StateDestroyInProgress;
 11058        }
 1059
 1060        //
 1061        // Shutdown and destroy all the incoming and outgoing Ice
 1062        // connections and wait for the connections to be finished.
 1063        //
 11064        _objectAdapterFactory?.shutdown();
 1065
 11066        _outgoingConnectionFactory?.destroy();
 1067
 11068        _objectAdapterFactory?.destroy();
 1069
 11070        _outgoingConnectionFactory?.waitUntilFinished();
 1071
 11072        _retryQueue?.destroy(); // Must be called before destroying thread pools.
 1073
 11074        _initData.observer?.setObserverUpdater(null);
 1075
 11076        if (_initData.logger is LoggerAdminLogger loggerAdminLogger)
 1077        {
 11078            loggerAdminLogger.destroy();
 1079        }
 1080
 1081        //
 1082        // Now, destroy the thread pools. This must be done *only* after
 1083        // all the connections are finished (the connections destruction
 1084        // can require invoking callbacks with the thread pools).
 1085        //
 11086        _serverThreadPool?.destroy();
 11087        _clientThreadPool?.destroy();
 11088        _endpointHostResolver?.destroy();
 1089
 1090        //
 1091        // Wait for all the threads to be finished.
 1092        //
 11093        _timer?.destroy();
 11094        _clientThreadPool?.joinWithAllThreads();
 11095        _serverThreadPool?.joinWithAllThreads();
 11096        _endpointHostResolver?.joinWithThread();
 1097
 11098        _routerManager?.destroy();
 1099
 11100        _locatorManager?.destroy();
 1101
 11102        if (_initData.properties.getIcePropertyAsInt("Ice.Warn.UnusedProperties") > 0)
 1103        {
 01104            List<string> unusedProperties = _initData.properties.getUnusedProperties();
 01105            if (unusedProperties.Count != 0)
 1106            {
 01107                var message = new StringBuilder("The following properties were set but never read:");
 01108                foreach (string s in unusedProperties)
 1109                {
 01110                    message.Append("\n    ");
 01111                    message.Append(s);
 1112                }
 01113                _initData.logger.warning(message.ToString());
 1114            }
 1115        }
 1116
 1117        //
 1118        // Destroy last so that a Logger plugin can receive all log/traces before its destruction.
 1119        //
 11120        _pluginManager?.destroy();
 1121
 11122        lock (_mutex)
 1123        {
 11124            _objectAdapterFactory = null;
 11125            _outgoingConnectionFactory = null;
 11126            _retryQueue = null;
 1127
 11128            _serverThreadPool = null;
 11129            _clientThreadPool = null;
 11130            _endpointHostResolver = null;
 11131            _timer = null;
 1132
 11133            _referenceFactory = null;
 11134            _routerManager = null;
 11135            _locatorManager = null;
 11136            _endpointFactoryManager = null;
 11137            _pluginManager = null;
 1138
 11139            _adminAdapter = null;
 11140            _adminFacets.Clear();
 1141
 11142            _state = StateDestroyed;
 11143            Monitor.PulseAll(_mutex);
 11144        }
 1145
 11146        if (_initData.logger is FileLoggerI fileLogger)
 1147        {
 11148            fileLogger.destroy();
 1149        }
 11150    }
 1151
 1152    public BufSizeWarnInfo getBufSizeWarn(short type)
 1153    {
 01154        lock (_setBufSizeWarn)
 1155        {
 1156            BufSizeWarnInfo info;
 01157            if (!_setBufSizeWarn.TryGetValue(type, out BufSizeWarnInfo value))
 1158            {
 01159                info = new BufSizeWarnInfo();
 01160                info.sndWarn = false;
 01161                info.sndSize = -1;
 01162                info.rcvWarn = false;
 01163                info.rcvSize = -1;
 01164                _setBufSizeWarn.Add(type, info);
 1165            }
 1166            else
 1167            {
 01168                info = _setBufSizeWarn[type];
 1169            }
 01170            return info;
 1171        }
 01172    }
 1173
 1174    public void setSndBufSizeWarn(short type, int size)
 1175    {
 01176        lock (_setBufSizeWarn)
 1177        {
 01178            BufSizeWarnInfo info = getBufSizeWarn(type);
 01179            info.sndWarn = true;
 01180            info.sndSize = size;
 01181            _setBufSizeWarn[type] = info;
 01182        }
 01183    }
 1184
 1185    public void setRcvBufSizeWarn(short type, int size)
 1186    {
 01187        lock (_setBufSizeWarn)
 1188        {
 01189            BufSizeWarnInfo info = getBufSizeWarn(type);
 01190            info.rcvWarn = true;
 01191            info.rcvSize = size;
 01192            _setBufSizeWarn[type] = info;
 01193        }
 01194    }
 1195
 1196    internal void updateConnectionObservers()
 1197    {
 1198        try
 1199        {
 1200            Debug.Assert(_outgoingConnectionFactory != null);
 11201            _outgoingConnectionFactory.updateConnectionObservers();
 1202            Debug.Assert(_objectAdapterFactory != null);
 11203            _objectAdapterFactory.updateConnectionObservers();
 11204        }
 01205        catch (Ice.CommunicatorDestroyedException)
 1206        {
 01207        }
 11208    }
 1209
 1210    internal void updateThreadObservers()
 1211    {
 1212        try
 1213        {
 11214            _clientThreadPool?.updateObservers();
 11215            _serverThreadPool?.updateObservers();
 1216            Debug.Assert(_objectAdapterFactory != null);
 11217            _objectAdapterFactory.updateThreadObservers();
 11218            _endpointHostResolver?.updateObserver();
 11219            _timer?.updateObserver(_initData.observer);
 11220        }
 01221        catch (Ice.CommunicatorDestroyedException)
 1222        {
 01223        }
 11224    }
 1225
 1226    internal void addAllAdminFacets()
 1227    {
 11228        lock (_mutex)
 1229        {
 11230            var filteredFacets = new Dictionary<string, Ice.Object>();
 1231
 11232            foreach (KeyValuePair<string, Ice.Object> entry in _adminFacets)
 1233            {
 11234                if (_adminFacetFilter.Count == 0 || _adminFacetFilter.Contains(entry.Key))
 1235                {
 11236                    _adminAdapter.addFacet(entry.Value, _adminIdentity, entry.Key);
 1237                }
 1238                else
 1239                {
 01240                    filteredFacets.Add(entry.Key, entry.Value);
 1241                }
 1242            }
 11243            _adminFacets = filteredFacets;
 11244        }
 11245    }
 1246
 1247    internal void setServerProcessProxy(Ice.ObjectAdapter adminAdapter, Ice.Identity adminIdentity)
 1248    {
 11249        Ice.ObjectPrx admin = adminAdapter.createProxy(adminIdentity);
 11250        Ice.LocatorPrx locator = adminAdapter.getLocator();
 11251        string serverId = _initData.properties.getIceProperty("Ice.Admin.ServerId");
 1252
 11253        if (locator != null && serverId.Length > 0)
 1254        {
 01255            Ice.ProcessPrx process = Ice.ProcessPrxHelper.uncheckedCast(admin.ice_facet("Process"));
 1256            try
 1257            {
 1258                //
 1259                // Note that as soon as the process proxy is registered, the communicator might be
 1260                // shutdown by a remote client and admin facets might start receiving calls.
 1261                //
 01262                locator.getRegistry().setServerProcessProxy(serverId, process);
 01263            }
 01264            catch (Ice.ServerNotFoundException)
 1265            {
 01266                if (_traceLevels.location >= 1)
 1267                {
 01268                    var s = new System.Text.StringBuilder();
 01269                    s.Append("couldn't register server `" + serverId + "' with the locator registry:\n");
 01270                    s.Append("the server is not known to the locator registry");
 01271                    _initData.logger.trace(_traceLevels.locationCat, s.ToString());
 1272                }
 1273
 01274                throw new Ice.InitializationException("Locator knows nothing about server `" + serverId + "'");
 1275            }
 01276            catch (Ice.LocalException ex)
 1277            {
 01278                if (_traceLevels.location >= 1)
 1279                {
 01280                    var s = new System.Text.StringBuilder();
 01281                    s.Append("couldn't register server `" + serverId + "' with the locator registry:\n" + ex);
 01282                    _initData.logger.trace(_traceLevels.locationCat, s.ToString());
 1283                }
 01284                throw; // TODO: Shall we raise a special exception instead of a non obvious local exception?
 1285            }
 1286
 01287            if (_traceLevels.location >= 1)
 1288            {
 01289                var s = new System.Text.StringBuilder();
 01290                s.Append("registered server `" + serverId + "' with the locator registry");
 01291                _initData.logger.trace(_traceLevels.locationCat, s.ToString());
 1292            }
 1293        }
 11294    }
 1295
 1296    internal ConnectionOptions serverConnectionOptions(string adapterName)
 1297    {
 1298        Debug.Assert(adapterName.Length > 0);
 11299        Properties properties = _initData.properties;
 11300        string propertyPrefix = $"{adapterName}.Connection";
 1301
 11302        return new(
 11303            connectTimeout: TimeSpan.FromSeconds(properties.getPropertyAsIntWithDefault(
 11304                $"{propertyPrefix}.ConnectTimeout",
 11305                (int)_serverConnectionOptions.connectTimeout.TotalSeconds)),
 11306
 11307            closeTimeout: TimeSpan.FromSeconds(properties.getPropertyAsIntWithDefault(
 11308                $"{propertyPrefix}.CloseTimeout",
 11309                (int)_serverConnectionOptions.closeTimeout.TotalSeconds)),
 11310
 11311            idleTimeout: TimeSpan.FromSeconds(properties.getPropertyAsIntWithDefault(
 11312                $"{propertyPrefix}.IdleTimeout",
 11313                (int)_serverConnectionOptions.idleTimeout.TotalSeconds)),
 11314
 11315            enableIdleCheck: properties.getPropertyAsIntWithDefault(
 11316                $"{propertyPrefix}.EnableIdleCheck",
 11317                _serverConnectionOptions.enableIdleCheck ? 1 : 0) > 0,
 11318
 11319            inactivityTimeout: TimeSpan.FromSeconds(properties.getPropertyAsIntWithDefault(
 11320                $"{propertyPrefix}.InactivityTimeout",
 11321                (int)_serverConnectionOptions.inactivityTimeout.TotalSeconds)),
 11322
 11323            maxDispatches: properties.getPropertyAsIntWithDefault(
 11324                $"{propertyPrefix}.MaxDispatches",
 11325                _serverConnectionOptions.maxDispatches));
 1326    }
 1327
 11328    internal SliceLoader sliceLoader => _initData.sliceLoader; // set in initialize
 1329
 11330    internal ConnectionOptions clientConnectionOptions { get; private set; } = null!; // set in initialize
 1331
 11332    internal int[] retryIntervals { get; private set; }
 1333
 1334    private NetworkProxy createNetworkProxy(Ice.Properties props, int protocolSupport)
 1335    {
 1336        string proxyHost;
 1337
 11338        proxyHost = props.getIceProperty("Ice.SOCKSProxyHost");
 11339        if (proxyHost.Length > 0)
 1340        {
 11341            if (protocolSupport == Network.EnableIPv6)
 1342            {
 01343                throw new Ice.InitializationException("IPv6 only is not supported with SOCKS4 proxies");
 1344            }
 11345            int proxyPort = props.getIcePropertyAsInt("Ice.SOCKSProxyPort");
 11346            return new SOCKSNetworkProxy(proxyHost, proxyPort);
 1347        }
 1348
 11349        proxyHost = props.getIceProperty("Ice.HTTPProxyHost");
 11350        if (proxyHost.Length > 0)
 1351        {
 11352            return new HTTPNetworkProxy(proxyHost, props.getIcePropertyAsInt("Ice.HTTPProxyPort"));
 1353        }
 1354
 11355        return null;
 1356    }
 1357
 1358    private ConnectionOptions readConnectionOptions(string propertyPrefix)
 1359    {
 11360        Properties properties = _initData.properties;
 1361
 1362        // The TimeSpan value can be <= 0. In this case, the timeout is considered infinite.
 11363        return new(
 11364            connectTimeout: TimeSpan.FromSeconds(properties.getIcePropertyAsInt($"{propertyPrefix}.ConnectTimeout")),
 11365            closeTimeout: TimeSpan.FromSeconds(properties.getIcePropertyAsInt($"{propertyPrefix}.CloseTimeout")),
 11366            idleTimeout: TimeSpan.FromSeconds(properties.getIcePropertyAsInt($"{propertyPrefix}.IdleTimeout")),
 11367            enableIdleCheck: properties.getIcePropertyAsInt($"{propertyPrefix}.EnableIdleCheck") > 0,
 11368            inactivityTimeout:
 11369                TimeSpan.FromSeconds(properties.getIcePropertyAsInt($"{propertyPrefix}.InactivityTimeout")),
 11370            maxDispatches: properties.getIcePropertyAsInt($"{propertyPrefix}.MaxDispatches"));
 1371    }
 1372
 1373    private static bool _printProcessIdDone;
 1374    private static bool _oneOffDone;
 11375    private static readonly object _staticLock = new object();
 1376
 1377    private const int StateActive = 0;
 1378    private const int StateDestroyInProgress = 1;
 1379    private const int StateDestroyed = 2;
 1380
 1381    private int _state;
 1382    private Ice.InitializationData _initData; // Immutable, not reset by destroy().
 1383    private TraceLevels _traceLevels; // Immutable, not reset by destroy().
 1384    private DefaultsAndOverrides _defaultsAndOverrides; // Immutable, not reset by destroy().
 1385    private int _messageSizeMax; // Immutable, not reset by destroy().
 1386    private int _batchAutoFlushSize; // Immutable, not reset by destroy().
 1387    private int _classGraphDepthMax; // Immutable, not reset by destroy().
 1388    private Ice.ToStringMode _toStringMode; // Immutable, not reset by destroy().
 1389    private int _cacheMessageBuffers; // Immutable, not reset by destroy().
 1390    private Ice.ImplicitContextI _implicitContext; // Immutable
 1391    private RouterManager _routerManager;
 1392    private LocatorManager _locatorManager;
 1393    private ReferenceFactory _referenceFactory;
 1394    private OutgoingConnectionFactory _outgoingConnectionFactory;
 1395    private ObjectAdapterFactory _objectAdapterFactory;
 1396    private int _protocolSupport;
 1397    private bool _preferIPv6;
 1398    private NetworkProxy _networkProxy;
 1399    private ThreadPool _clientThreadPool;
 1400    private ThreadPool _serverThreadPool;
 1401    private EndpointHostResolver _endpointHostResolver;
 1402    private Timer _timer;
 1403    private RetryQueue _retryQueue;
 1404    private EndpointFactoryManager _endpointFactoryManager;
 1405    private Ice.PluginManager _pluginManager;
 1406    private bool _adminEnabled;
 1407    private Ice.ObjectAdapter _adminAdapter;
 11408    private Dictionary<string, Ice.Object> _adminFacets = new();
 11409    private readonly HashSet<string> _adminFacetFilter = new();
 1410    private Ice.Identity _adminIdentity;
 11411    private readonly Dictionary<short, BufSizeWarnInfo> _setBufSizeWarn = new();
 1412    private ConnectionOptions _serverConnectionOptions; // set in initialize
 1413    private Ice.SSL.SSLEngine _sslEngine;
 1414
 1415    // The Slice loader(s) added by the application: initData.sliceLoader followed by the loaders added by
 1416    // addSliceLoader.
 11417    private readonly CompositeSliceLoader _applicationSliceLoader = new();
 1418
 11419    private readonly object _mutex = new object();
 1420}