zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2.03k stars 592 forks source link

Use getIceProperty methods #2493

Open bernardnormier opened 2 months ago

bernardnormier commented 2 months ago

There are many spots in the code where we should use getIcePropertyXxx but we don't. That's true for all language mappings.

For example:

bernard@studio src % rg -F "getPropertyAsIntWithDefault(\"Ice"
IceGrid/IceGridRegistry.cpp
103:    if (!nowarn && properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 0) > 0)

Ice/Network.cpp
1352:    int32_t rcvSize = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
1353:    int32_t sndSize = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize);

IceGrid/IceGridNode.cpp
267:    if (!nowarn && properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 0) > 0)

IceGrid/RegistryI.cpp
1094:    return properties->getPropertyAsIntWithDefault("IceGrid.Registry.Client.Connection.IdleTimeout", idleTimeout);

Ice/ios/StreamAcceptor.cpp
129:    _backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN);
131:    _backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);

Ice/TcpAcceptor.cpp
201:    _backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN);

Ice/BatchRequestQueue.cpp
62:            initData.properties->getPropertyAsIntWithDefault("Ice.UDP.SndSize", 65535 - udpOverhead));

Ice/Instance.cpp
959:                if (_initData.properties->getPropertyAsIntWithDefault("Ice.PrintStackTraces", 1) == 0)
externl commented 2 months ago

As I mentioned when I initially did this there are likely some that are missing and need to be updated.

However, I specifically did not add defaults for properties which do not have one single default, eg. ones where the default value is platform specified, etc. Such as for the ones you've listed above.

They can't use getIcePropety because:

We shouldn't have a blanket issue (like this one) for this but list specific ones to fix as it's not as simple as grepping.