group connection queries now return our own connection type

This commit is contained in:
jfreegman 2023-12-04 10:35:50 -05:00
parent a4df2862ed
commit 84ba154f6a
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
4 changed files with 9 additions and 5 deletions

View File

@ -1 +1 @@
12972fcd956654a18e367e03d6bcaab12fbe2ae166dfc937474a7bd123e0910f /usr/local/bin/tox-bootstrapd 2e1ae94d48eb1793ec3b42ed1516c53fb0b6b0e41bc89160e6037ee881a872b4 /usr/local/bin/tox-bootstrapd

View File

@ -3510,8 +3510,8 @@ unsigned int gc_get_peer_connection_status(const GC_Chat *chat, uint32_t peer_id
{ {
const int peer_number = get_peer_number_of_peer_id(chat, peer_id); const int peer_number = get_peer_number_of_peer_id(chat, peer_id);
if (peer_number_is_self(peer_number)) { // we cannot have a connection with ourselves if (peer_number_is_self(peer_number)) {
return 0; return chat->self_udp_status == SELF_UDP_STATUS_NONE ? 1 : 2;
} }
const GC_Connection *gconn = get_gc_connection(chat, peer_number); const GC_Connection *gconn = get_gc_connection(chat, peer_number);

View File

@ -391,10 +391,13 @@ non_null(1) nullable(3)
int gc_get_peer_public_key_by_peer_id(const GC_Chat *chat, uint32_t peer_id, uint8_t *public_key); int gc_get_peer_public_key_by_peer_id(const GC_Chat *chat, uint32_t peer_id, uint8_t *public_key);
/** @brief Gets the connection status for peer associated with `peer_id`. /** @brief Gets the connection status for peer associated with `peer_id`.
*
* If `peer_id` designates ourself, the return value indicates whether we're capable
* of making UDP connections with other peers, or are limited to TCP connections.
* *
* Returns 2 if we have a direct (UDP) connection with a peer. * Returns 2 if we have a direct (UDP) connection with a peer.
* Returns 1 if we have an indirect (TCP) connection with a peer. * Returns 1 if we have an indirect (TCP) connection with a peer.
* Returns 0 if peer_id is invalid or corresponds to ourselves. * Returns 0 if peer_id is invalid.
* *
* Note: Return values must correspond to Tox_Connection enum in API. * Note: Return values must correspond to Tox_Connection enum in API.
*/ */

View File

@ -3967,7 +3967,8 @@ Tox_Group_Role tox_group_peer_get_role(const Tox *tox, uint32_t group_number, ui
/** /**
* Return the type of connection we have established with a peer. * Return the type of connection we have established with a peer.
* *
* This function will return an error if called on ourselves. * If `peer_id` designates ourself, the return value indicates whether we're capable
* of making UDP connections with other peers, or are limited to TCP connections.
* *
* @param group_number The group number of the group we wish to query. * @param group_number The group number of the group we wish to query.
* @param peer_id The ID of the peer whose connection status we wish to query. * @param peer_id The ID of the peer whose connection status we wish to query.