From 3dafabde9c140f35caef27a4f235cb2e0c69b778 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 13 Aug 2023 15:56:21 -0400 Subject: [PATCH] src: set port in node_options to uint16_t --- src/node_options.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/node_options.h b/src/node_options.h index bb8b68894b4430..44de5c120bfc5e 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -28,24 +28,23 @@ class HostPort { void set_host(const std::string& host) { host_name_ = host; } - void set_port(int port) { port_ = port; } + void set_port(uint16_t port) { port_ = port; } const std::string& host() const { return host_name_; } - int port() const { - // TODO(joyeecheung): make port a uint16_t + uint16_t port() const { CHECK_GE(port_, 0); return port_; } void Update(const HostPort& other) { if (!other.host_name_.empty()) host_name_ = other.host_name_; - if (other.port_ >= 0) port_ = other.port_; + port_ = other.port_; } private: std::string host_name_; - int port_; + uint16_t port_; }; class Options {