Repository: envoyproxy/envoy
File: envoy/server/hot_restart.h (C/C++)

Code before:
  };

  struct AdminShutdownResponse {
    time_t original_start_time_;
    bool enable_reuse_port_default_;
  };

  virtual ~HotRestart() = default;

  /**
   * Shutdown listeners in the parent process if applicable. Listeners will begin draining to
   * clear out old connections.
   */
  virtual void drainParentListeners() PURE;

  /**
   * Retrieve a listening socket on the specified address from the parent process. The socket will
   * be duplicated across process boundaries.
   * @param address supplies the address of the socket to duplicate, e.g. tcp://127.0.0.1:5000.
   * @param worker_index supplies the socket/worker index to fetch. When using reuse_port sockets
   *        each socket is fetched individually to ensure no connection loss.
   * @param network_namespace supplies the network namespace of the socket, if any.
   * @return int the fd or -1 if there is no bound listen port in the parent.
   */
  virtual int duplicateParentListenSocket(const std::string& address, uint32_t worker_index,
                                          const std::string& network_namespace) PURE;

  /**
   * Registers a UdpListenerConfig as a possible receiver of udp packets forwarded from the
   * parent process to the child process. This is used to forward QUIC packets that are not for
   * connections belonging to the parent process during draining (in the absence of BPF delivery to
   * the correct process), via its listenerWorkerRouter.
   * The HotRestart instance is responsible for recognizing "any" addresses (e.g. "0.0.0.0").
   * @param address supplies the address and port of the listening socket.
   * @param listener_config is the UdpListenerConfig to receive packets forwarded for the given
   * address.
   */
  virtual void
  registerUdpForwardingListener(Network::Address::InstanceConstSharedPtr address,
                                std::shared_ptr<Network::UdpListenerConfig> listener_config) PURE;

  /**
   * @return An interface on which registerParentDrainedCallback can be called during
   *         creation of a listener, or nullopt if there is no parent instance.
   *
   *         If this is set, any UDP listener should start paused and only begin listening
   *         when the parent instance is drained; this allows draining QUIC listeners to
   *         catch their own packets and forward unrecognized packets to the child instance.
   */
  virtual OptRef<Network::ParentDrainedCallbackRegistrar> parentDrainedCallbackRegistrar() PURE;


Review comment (suggestion):
```suggestion
                                          absl::string_view network_namespace) PURE;
```

Code after:
  };

  struct AdminShutdownResponse {
    time_t original_start_time_;
    bool enable_reuse_port_default_;
  };

  virtual ~HotRestart() = default;

  /**
   * Shutdown listeners in the parent process if applicable. Listeners will begin draining to
   * clear out old connections.
   */
  virtual void drainParentListeners() PURE;

  /**
   * Retrieve a listening socket on the specified address from the parent process. The socket will
   * be duplicated across process boundaries.
   * @param address supplies the address of the socket to duplicate, e.g. tcp://127.0.0.1:5000.
   * @param worker_index supplies the socket/worker index to fetch. When using reuse_port sockets
   *        each socket is fetched individually to ensure no connection loss.
   * @param network_namespace supplies the network namespace of the socket, if any.
   * @return int the fd or -1 if there is no bound listen port in the parent.
   */
  virtual int duplicateParentListenSocket(const std::string& address, uint32_t worker_index,
                                          absl::string_view network_namespace) PURE;

  /**
   * Registers a UdpListenerConfig as a possible receiver of udp packets forwarded from the
   * parent process to the child process. This is used to forward QUIC packets that are not for
   * connections belonging to the parent process during draining (in the absence of BPF delivery to
   * the correct process), via its listenerWorkerRouter.
   * The HotRestart instance is responsible for recognizing "any" addresses (e.g. "0.0.0.0").
   * @param address supplies the address and port of the listening socket.
   * @param listener_config is the UdpListenerConfig to receive packets forwarded for the given
   * address.
   */
  virtual void
  registerUdpForwardingListener(Network::Address::InstanceConstSharedPtr address,
                                std::shared_ptr<Network::UdpListenerConfig> listener_config) PURE;

  /**
   * @return An interface on which registerParentDrainedCallback can be called during
   *         creation of a listener, or nullopt if there is no parent instance.
   *
   *         If this is set, any UDP listener should start paused and only begin listening
   *         when the parent instance is drained; this allows draining QUIC listeners to
   *         catch their own packets and forward unrecognized packets to the child instance.
   */
  virtual OptRef<Network::ParentDrainedCallbackRegistrar> parentDrainedCallbackRegistrar() PURE;