Skip to content

Commit 3dafabd

Browse files
committed
src: set port in node_options to uint16_t
1 parent b5da2f4 commit 3dafabd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/node_options.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,23 @@ class HostPort {
2828

2929
void set_host(const std::string& host) { host_name_ = host; }
3030

31-
void set_port(int port) { port_ = port; }
31+
void set_port(uint16_t port) { port_ = port; }
3232

3333
const std::string& host() const { return host_name_; }
3434

35-
int port() const {
36-
// TODO(joyeecheung): make port a uint16_t
35+
uint16_t port() const {
3736
CHECK_GE(port_, 0);
3837
return port_;
3938
}
4039

4140
void Update(const HostPort& other) {
4241
if (!other.host_name_.empty()) host_name_ = other.host_name_;
43-
if (other.port_ >= 0) port_ = other.port_;
42+
port_ = other.port_;
4443
}
4544

4645
private:
4746
std::string host_name_;
48-
int port_;
47+
uint16_t port_;
4948
};
5049

5150
class Options {

0 commit comments

Comments
 (0)