Skip to content

Commit 88ffd1a

Browse files
committed
fix: resolve_bootstrap_node() not checking net_getipport() returned count correctly
doc: improve inline docu of return of net_getipport
1 parent d222d70 commit 88ffd1a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1fadb7de1ccf46186e33c13343e2c67f4c84e78fadfbfbbc8f3ce70e670907f2 /usr/local/bin/tox-bootstrapd
1+
3d28c914487efaae4336af17b221049c73249fb917d672f5ae6d9c092522a24f /usr/local/bin/tox-bootstrapd

toxcore/network.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,9 @@ bool net_connect(const Logger *log, Socket sock, const IP_Port *ip_port);
544544
* Skip all addresses with socktype != type (use type = -1 to get all addresses)
545545
* To correctly deallocate array memory use `net_freeipport()`
546546
*
547-
* return number of elements in res array
548-
* and -1 on error.
547+
* @return number of elements in res array.
548+
* @retval 0 if res array empty.
549+
* @retval -1 on error.
549550
*/
550551
non_null()
551552
int32_t net_getipport(const char *node, IP_Port **res, int tox_type);

toxcore/tox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ static int32_t resolve_bootstrap_node(Tox *tox, const char *host, uint16_t port,
10081008

10091009
const int32_t count = net_getipport(host, root, TOX_SOCK_DGRAM);
10101010

1011-
if (count == -1) {
1011+
if (count < 1) {
10121012
LOGGER_DEBUG(tox->m->log, "could not resolve bootstrap node '%s'", host);
10131013
net_freeipport(*root);
10141014
SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_HOST);

0 commit comments

Comments
 (0)