dmlc / dmlc/ps-lite

GetAvailablePort function

Open
#83 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
1.6k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

src/network_utils.h:

Perhaps two issues on the function GetAvailablePort.

First of all, although it doesn't affect the expected behavior of the function GetAvailablePort, it might be better to return -1 instead of 0 if there is any error. After all, port 0 is reserved by TCP/IP suite.
If this function returns -1 instead of 0, CHECK() should also be replaced by CHECH_LT().

Second, necessary calls to close(sock) are missing when there are errors amid, so memory leak might happen in some corner cases.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.