diff --git a/envoy/network/address.h b/envoy/network/address.h index 4a305be74694..bd28205bd630 100644 --- a/envoy/network/address.h +++ b/envoy/network/address.h @@ -209,7 +209,6 @@ class Instance { }; using InstanceConstSharedPtr = std::shared_ptr; -using InstanceConstPtr = std::unique_ptr; } // namespace Address } // namespace Network diff --git a/source/common/network/address_impl.h b/source/common/network/address_impl.h index 39d5e97d3514..f1b011a8917e 100644 --- a/source/common/network/address_impl.h +++ b/source/common/network/address_impl.h @@ -69,14 +69,15 @@ class InstanceBase : public Instance { const Type type_; }; +// Create an address instance. Upon failure, return an error status without throwing. class InstanceFactory { public: template - static StatusOr createInstancePtr(Args&&... args) { + static StatusOr createInstancePtr(Args&&... args) { absl::Status status; // Use new instead of make_unique here because the instance constructors are private and must be // called directly here. - std::unique_ptr instance(new InstanceType(status, std::forward(args)...)); + std::shared_ptr instance(new InstanceType(status, std::forward(args)...)); if (!status.ok()) { return status; }