mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
fix: resolve_bootstrap_node() not checking net_getipport() returned count correctly
doc: improve inline docu of return of net_getipport
This commit is contained in:
parent
d222d708b5
commit
88ffd1a649
|
@ -1 +1 @@
|
||||||
1fadb7de1ccf46186e33c13343e2c67f4c84e78fadfbfbbc8f3ce70e670907f2 /usr/local/bin/tox-bootstrapd
|
3d28c914487efaae4336af17b221049c73249fb917d672f5ae6d9c092522a24f /usr/local/bin/tox-bootstrapd
|
||||||
|
|
|
@ -544,8 +544,9 @@ bool net_connect(const Logger *log, Socket sock, const IP_Port *ip_port);
|
||||||
* Skip all addresses with socktype != type (use type = -1 to get all addresses)
|
* Skip all addresses with socktype != type (use type = -1 to get all addresses)
|
||||||
* To correctly deallocate array memory use `net_freeipport()`
|
* To correctly deallocate array memory use `net_freeipport()`
|
||||||
*
|
*
|
||||||
* return number of elements in res array
|
* @return number of elements in res array.
|
||||||
* and -1 on error.
|
* @retval 0 if res array empty.
|
||||||
|
* @retval -1 on error.
|
||||||
*/
|
*/
|
||||||
non_null()
|
non_null()
|
||||||
int32_t net_getipport(const char *node, IP_Port **res, int tox_type);
|
int32_t net_getipport(const char *node, IP_Port **res, int tox_type);
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ static int32_t resolve_bootstrap_node(Tox *tox, const char *host, uint16_t port,
|
||||||
|
|
||||||
const int32_t count = net_getipport(host, root, TOX_SOCK_DGRAM);
|
const int32_t count = net_getipport(host, root, TOX_SOCK_DGRAM);
|
||||||
|
|
||||||
if (count == -1) {
|
if (count < 1) {
|
||||||
LOGGER_DEBUG(tox->m->log, "could not resolve bootstrap node '%s'", host);
|
LOGGER_DEBUG(tox->m->log, "could not resolve bootstrap node '%s'", host);
|
||||||
net_freeipport(*root);
|
net_freeipport(*root);
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_HOST);
|
SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_HOST);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user