mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
cleanup: Clean up comparing bools with ints
This commit is contained in:
parent
0ca2882b92
commit
0ac930e1f6
|
@ -1 +1 @@
|
|||
dd4f76c70a0f0a4799b73ee372d81dbc6228e4b25890b7d5f4b0a89950e1c465 /usr/local/bin/tox-bootstrapd
|
||||
e79b800f95e9dd714128de63824483facac7487788d57a9c89ef2e1c39d3588f /usr/local/bin/tox-bootstrapd
|
||||
|
|
|
@ -15,7 +15,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
|
|||
COPY --from=tokstyle /bin/check-c /bin/
|
||||
RUN ["git", "clone", "--depth=1", "https://github.com/TokTok/hs-tokstyle", "/src/workspace/hs-tokstyle"]
|
||||
|
||||
COPY toxav/ /src/workspace/c-toxcore/toxcore/
|
||||
COPY toxav/ /src/workspace/c-toxcore/toxav/
|
||||
COPY toxcore/ /src/workspace/c-toxcore/toxcore/
|
||||
COPY toxencryptsave/ /src/workspace/c-toxcore/toxencryptsave/
|
||||
RUN /bin/check-c $(find /src/workspace/c-toxcore -name "*.c")
|
||||
|
|
|
@ -1452,7 +1452,7 @@ static bool call_prepare_transmission(ToxAVCall *call)
|
|||
}
|
||||
}
|
||||
|
||||
call->active = 1;
|
||||
call->active = true;
|
||||
return true;
|
||||
|
||||
FAILURE:
|
||||
|
@ -1473,11 +1473,11 @@ FAILURE_2:
|
|||
|
||||
static void call_kill_transmission(ToxAVCall *call)
|
||||
{
|
||||
if (call == nullptr || call->active == 0) {
|
||||
if (call == nullptr || !call->active) {
|
||||
return;
|
||||
}
|
||||
|
||||
call->active = 0;
|
||||
call->active = false;
|
||||
|
||||
pthread_mutex_lock(call->mutex_audio);
|
||||
pthread_mutex_unlock(call->mutex_audio);
|
||||
|
|
|
@ -526,9 +526,8 @@ int m_send_message_generic(Messenger *m, int32_t friendnumber, uint8_t type, con
|
|||
VLA(uint8_t, packet, length + 1);
|
||||
packet[0] = PACKET_ID_MESSAGE + type;
|
||||
|
||||
if (length != 0) {
|
||||
memcpy(packet + 1, message, length);
|
||||
}
|
||||
assert(message != nullptr);
|
||||
memcpy(packet + 1, message, length);
|
||||
|
||||
const int64_t packet_num = write_cryptpacket(m->net_crypto, friend_connection_crypt_connection_id(m->fr_c,
|
||||
m->friendlist[friendnumber].friendcon_id), packet, length + 1, false);
|
||||
|
@ -565,9 +564,8 @@ static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_
|
|||
VLA(uint8_t, packet, length + 1);
|
||||
packet[0] = packet_id;
|
||||
|
||||
if (length != 0) {
|
||||
memcpy(packet + 1, data, length);
|
||||
}
|
||||
assert(data != nullptr);
|
||||
memcpy(packet + 1, data, length);
|
||||
|
||||
return write_cryptpacket(m->net_crypto, friend_connection_crypt_connection_id(m->fr_c,
|
||||
m->friendlist[friendnumber].friendcon_id), packet, length + 1, congestion_control) != -1;
|
||||
|
@ -1077,14 +1075,14 @@ int file_get_id(const Messenger *m, int32_t friendnumber, uint32_t filenumber, u
|
|||
}
|
||||
|
||||
uint32_t temp_filenum;
|
||||
bool send_receive;
|
||||
bool inbound;
|
||||
uint8_t file_number;
|
||||
|
||||
if (filenumber >= (1 << 16)) {
|
||||
send_receive = true;
|
||||
inbound = true;
|
||||
temp_filenum = (filenumber >> 16) - 1;
|
||||
} else {
|
||||
send_receive = false;
|
||||
inbound = false;
|
||||
temp_filenum = filenumber;
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1094,7 @@ int file_get_id(const Messenger *m, int32_t friendnumber, uint32_t filenumber, u
|
|||
|
||||
struct File_Transfers *ft;
|
||||
|
||||
if (send_receive) {
|
||||
if (inbound) {
|
||||
ft = &m->friendlist[friendnumber].file_receiving[file_number];
|
||||
} else {
|
||||
ft = &m->friendlist[friendnumber].file_sending[file_number];
|
||||
|
@ -1195,7 +1193,7 @@ long int new_filesender(const Messenger *m, int32_t friendnumber, uint32_t file_
|
|||
}
|
||||
|
||||
non_null(1) nullable(6)
|
||||
static int send_file_control_packet(const Messenger *m, int32_t friendnumber, bool send_receive, uint8_t filenumber,
|
||||
static int send_file_control_packet(const Messenger *m, int32_t friendnumber, bool inbound, uint8_t filenumber,
|
||||
uint8_t control_type, const uint8_t *data, uint16_t data_length)
|
||||
{
|
||||
assert(data_length == 0 || data != nullptr);
|
||||
|
@ -1206,7 +1204,7 @@ static int send_file_control_packet(const Messenger *m, int32_t friendnumber, bo
|
|||
|
||||
VLA(uint8_t, packet, 3 + data_length);
|
||||
|
||||
packet[0] = send_receive ? 1 : 0;
|
||||
packet[0] = inbound ? 1 : 0;
|
||||
packet[1] = filenumber;
|
||||
packet[2] = control_type;
|
||||
|
||||
|
@ -1240,14 +1238,14 @@ int file_control(const Messenger *m, int32_t friendnumber, uint32_t filenumber,
|
|||
}
|
||||
|
||||
uint32_t temp_filenum;
|
||||
bool send_receive;
|
||||
bool inbound;
|
||||
uint8_t file_number;
|
||||
|
||||
if (filenumber >= (1 << 16)) {
|
||||
send_receive = true;
|
||||
inbound = true;
|
||||
temp_filenum = (filenumber >> 16) - 1;
|
||||
} else {
|
||||
send_receive = false;
|
||||
inbound = false;
|
||||
temp_filenum = filenumber;
|
||||
}
|
||||
|
||||
|
@ -1259,7 +1257,7 @@ int file_control(const Messenger *m, int32_t friendnumber, uint32_t filenumber,
|
|||
|
||||
struct File_Transfers *ft;
|
||||
|
||||
if (send_receive) {
|
||||
if (inbound) {
|
||||
ft = &m->friendlist[friendnumber].file_receiving[file_number];
|
||||
} else {
|
||||
ft = &m->friendlist[friendnumber].file_sending[file_number];
|
||||
|
@ -1291,15 +1289,15 @@ int file_control(const Messenger *m, int32_t friendnumber, uint32_t filenumber,
|
|||
return -7;
|
||||
}
|
||||
|
||||
if (!send_receive) {
|
||||
if (!inbound) {
|
||||
return -6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (send_file_control_packet(m, friendnumber, send_receive, file_number, control, nullptr, 0)) {
|
||||
if (send_file_control_packet(m, friendnumber, inbound, file_number, control, nullptr, 0)) {
|
||||
if (control == FILECONTROL_KILL) {
|
||||
if (send_receive == 0 && (ft->status == FILESTATUS_TRANSFERRING || ft->status == FILESTATUS_FINISHED)) {
|
||||
if (!inbound && (ft->status == FILESTATUS_TRANSFERRING || ft->status == FILESTATUS_FINISHED)) {
|
||||
// We are actively sending that file, remove from list
|
||||
--m->friendlist[friendnumber].num_sending_files;
|
||||
}
|
||||
|
@ -1374,7 +1372,7 @@ int file_seek(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uin
|
|||
uint8_t sending_pos[sizeof(uint64_t)];
|
||||
net_pack_u64(sending_pos, position);
|
||||
|
||||
if (send_file_control_packet(m, friendnumber, 1, file_number, FILECONTROL_SEEK, sending_pos,
|
||||
if (send_file_control_packet(m, friendnumber, true, file_number, FILECONTROL_SEEK, sending_pos,
|
||||
sizeof(sending_pos))) {
|
||||
ft->transferred = position;
|
||||
} else {
|
||||
|
@ -1401,7 +1399,7 @@ static int64_t send_file_data_packet(const Messenger *m, int32_t friendnumber, u
|
|||
packet[0] = PACKET_ID_FILE_DATA;
|
||||
packet[1] = filenumber;
|
||||
|
||||
if (length != 0) {
|
||||
if (length > 0) {
|
||||
memcpy(packet + 2, data, length);
|
||||
}
|
||||
|
||||
|
@ -1624,17 +1622,17 @@ static void break_files(const Messenger *m, int32_t friendnumber)
|
|||
}
|
||||
|
||||
non_null()
|
||||
static struct File_Transfers *get_file_transfer(bool receive_send, uint8_t filenumber,
|
||||
static struct File_Transfers *get_file_transfer(bool outbound, uint8_t filenumber,
|
||||
uint32_t *real_filenumber, Friend *sender)
|
||||
{
|
||||
struct File_Transfers *ft;
|
||||
|
||||
if (!receive_send) {
|
||||
*real_filenumber = (filenumber + 1) << 16;
|
||||
ft = &sender->file_receiving[filenumber];
|
||||
} else {
|
||||
if (outbound) {
|
||||
*real_filenumber = filenumber;
|
||||
ft = &sender->file_sending[filenumber];
|
||||
} else {
|
||||
*real_filenumber = (filenumber + 1) << 16;
|
||||
ft = &sender->file_receiving[filenumber];
|
||||
}
|
||||
|
||||
if (ft->status == FILESTATUS_NONE) {
|
||||
|
@ -1647,22 +1645,22 @@ static struct File_Transfers *get_file_transfer(bool receive_send, uint8_t filen
|
|||
/** return -1 on failure, 0 on success.
|
||||
*/
|
||||
non_null(1, 6) nullable(8)
|
||||
static int handle_filecontrol(Messenger *m, int32_t friendnumber, bool receive_send, uint8_t filenumber,
|
||||
static int handle_filecontrol(Messenger *m, int32_t friendnumber, bool outbound, uint8_t filenumber,
|
||||
uint8_t control_type, const uint8_t *data, uint16_t length, void *userdata)
|
||||
{
|
||||
uint32_t real_filenumber;
|
||||
struct File_Transfers *ft = get_file_transfer(receive_send, filenumber, &real_filenumber, &m->friendlist[friendnumber]);
|
||||
struct File_Transfers *ft = get_file_transfer(outbound, filenumber, &real_filenumber, &m->friendlist[friendnumber]);
|
||||
|
||||
if (ft == nullptr) {
|
||||
LOGGER_DEBUG(m->log, "file control (friend %d, file %d): file transfer does not exist; telling the other to kill it",
|
||||
friendnumber, filenumber);
|
||||
send_file_control_packet(m, friendnumber, !receive_send, filenumber, FILECONTROL_KILL, nullptr, 0);
|
||||
send_file_control_packet(m, friendnumber, !outbound, filenumber, FILECONTROL_KILL, nullptr, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (control_type) {
|
||||
case FILECONTROL_ACCEPT: {
|
||||
if (receive_send && ft->status == FILESTATUS_NOT_ACCEPTED) {
|
||||
if (outbound && ft->status == FILESTATUS_NOT_ACCEPTED) {
|
||||
ft->status = FILESTATUS_TRANSFERRING;
|
||||
++m->friendlist[friendnumber].num_sending_files;
|
||||
} else {
|
||||
|
@ -1703,7 +1701,7 @@ static int handle_filecontrol(Messenger *m, int32_t friendnumber, bool receive_s
|
|||
m->file_filecontrol(m, friendnumber, real_filenumber, control_type, userdata);
|
||||
}
|
||||
|
||||
if (receive_send && (ft->status == FILESTATUS_TRANSFERRING || ft->status == FILESTATUS_FINISHED)) {
|
||||
if (outbound && (ft->status == FILESTATUS_TRANSFERRING || ft->status == FILESTATUS_FINISHED)) {
|
||||
--m->friendlist[friendnumber].num_sending_files;
|
||||
}
|
||||
|
||||
|
@ -1722,7 +1720,7 @@ static int handle_filecontrol(Messenger *m, int32_t friendnumber, bool receive_s
|
|||
}
|
||||
|
||||
/* seek can only be sent by the receiver to seek before resuming broken transfers. */
|
||||
if (ft->status != FILESTATUS_NOT_ACCEPTED || !receive_send) {
|
||||
if (ft->status != FILESTATUS_NOT_ACCEPTED || !outbound) {
|
||||
LOGGER_DEBUG(m->log,
|
||||
"file control (friend %d, file %d): seek was either sent by a sender or by the receiver after accepting",
|
||||
friendnumber, filenumber);
|
||||
|
@ -1983,7 +1981,7 @@ static int m_handle_packet(void *object, int i, const uint8_t *temp, uint16_t le
|
|||
|
||||
switch (packet_id) {
|
||||
case PACKET_ID_OFFLINE: {
|
||||
if (data_length != 0) {
|
||||
if (data_length > 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2143,7 +2141,7 @@ static int m_handle_packet(void *object, int i, const uint8_t *temp, uint16_t le
|
|||
VLA(uint8_t, filename_terminated, filename_length + 1);
|
||||
const uint8_t *filename = nullptr;
|
||||
|
||||
if (filename_length != 0) {
|
||||
if (filename_length > 0) {
|
||||
/* Force NULL terminate file name. */
|
||||
memcpy(filename_terminated, data + head_length, filename_length);
|
||||
filename_terminated[filename_length] = 0;
|
||||
|
@ -2167,7 +2165,10 @@ static int m_handle_packet(void *object, int i, const uint8_t *temp, uint16_t le
|
|||
break;
|
||||
}
|
||||
|
||||
const bool send_receive = data[0] != 0;
|
||||
// On the other side, "outbound" is "inbound", i.e. if they send 1,
|
||||
// that means "inbound" on their side, but we call it "outbound"
|
||||
// here.
|
||||
const bool outbound = data[0] == 1;
|
||||
uint8_t filenumber = data[1];
|
||||
const uint8_t control_type = data[2];
|
||||
|
||||
|
@ -2179,7 +2180,7 @@ static int m_handle_packet(void *object, int i, const uint8_t *temp, uint16_t le
|
|||
|
||||
#endif
|
||||
|
||||
if (handle_filecontrol(m, i, send_receive, filenumber, control_type, data + 3, data_length - 3, userdata) == -1) {
|
||||
if (handle_filecontrol(m, i, outbound, filenumber, control_type, data + 3, data_length - 3, userdata) == -1) {
|
||||
// TODO(iphydf): Do something different here? Right now, this
|
||||
// check is pointless.
|
||||
break;
|
||||
|
@ -3021,7 +3022,7 @@ static uint8_t *save_tcp_relays(const Messenger *m, uint8_t *data)
|
|||
non_null()
|
||||
static State_Load_Status load_tcp_relays(Messenger *m, const uint8_t *data, uint32_t length)
|
||||
{
|
||||
if (length != 0) {
|
||||
if (length > 0) {
|
||||
const int num = unpack_nodes(m->loaded_relays, NUM_SAVED_TCP_RELAYS, nullptr, data, length, 1);
|
||||
|
||||
if (num == -1) {
|
||||
|
@ -3067,7 +3068,7 @@ static State_Load_Status load_path_nodes(Messenger *m, const uint8_t *data, uint
|
|||
{
|
||||
Node_format nodes[NUM_SAVED_PATH_NODES];
|
||||
|
||||
if (length != 0) {
|
||||
if (length > 0) {
|
||||
const int num = unpack_nodes(nodes, NUM_SAVED_PATH_NODES, nullptr, data, length, 0);
|
||||
|
||||
if (num == -1) {
|
||||
|
|
|
@ -292,13 +292,13 @@ static bool add_to_closest(Group_c *g, const uint8_t *real_pk, const uint8_t *te
|
|||
unsigned int index = DESIRED_CLOSEST;
|
||||
|
||||
for (unsigned int i = 0; i < DESIRED_CLOSEST; ++i) {
|
||||
if (g->closest_peers[i].entry && public_key_cmp(real_pk, g->closest_peers[i].real_pk) == 0) {
|
||||
if (g->closest_peers[i].active && public_key_cmp(real_pk, g->closest_peers[i].real_pk) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < DESIRED_CLOSEST; ++i) {
|
||||
if (!g->closest_peers[i].entry) {
|
||||
if (!g->closest_peers[i].active) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
@ -337,13 +337,13 @@ static bool add_to_closest(Group_c *g, const uint8_t *real_pk, const uint8_t *te
|
|||
uint8_t old_temp_pk[CRYPTO_PUBLIC_KEY_SIZE];
|
||||
bool old = false;
|
||||
|
||||
if (g->closest_peers[index].entry) {
|
||||
if (g->closest_peers[index].active) {
|
||||
memcpy(old_real_pk, g->closest_peers[index].real_pk, CRYPTO_PUBLIC_KEY_SIZE);
|
||||
memcpy(old_temp_pk, g->closest_peers[index].temp_pk, CRYPTO_PUBLIC_KEY_SIZE);
|
||||
old = true;
|
||||
}
|
||||
|
||||
g->closest_peers[index].entry = true;
|
||||
g->closest_peers[index].active = true;
|
||||
memcpy(g->closest_peers[index].real_pk, real_pk, CRYPTO_PUBLIC_KEY_SIZE);
|
||||
memcpy(g->closest_peers[index].temp_pk, temp_pk, CRYPTO_PUBLIC_KEY_SIZE);
|
||||
|
||||
|
@ -362,7 +362,7 @@ non_null()
|
|||
static bool pk_in_closest_peers(const Group_c *g, const uint8_t *real_pk)
|
||||
{
|
||||
for (unsigned int i = 0; i < DESIRED_CLOSEST; ++i) {
|
||||
if (!g->closest_peers[i].entry) {
|
||||
if (!g->closest_peers[i].active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ static int send_packet_online(const Friend_Connections *fr_c, int friendcon_id,
|
|||
|
||||
non_null()
|
||||
static int add_conn_to_groupchat(Group_Chats *g_c, int friendcon_id, Group_c *g, uint8_t reason,
|
||||
uint8_t lock);
|
||||
bool lock);
|
||||
|
||||
non_null(1) nullable(3)
|
||||
static void add_closest_connections(Group_Chats *g_c, uint32_t groupnumber, void *userdata)
|
||||
|
@ -422,7 +422,7 @@ static void add_closest_connections(Group_Chats *g_c, uint32_t groupnumber, void
|
|||
}
|
||||
|
||||
for (uint32_t i = 0; i < DESIRED_CLOSEST; ++i) {
|
||||
if (!g->closest_peers[i].entry) {
|
||||
if (!g->closest_peers[i].active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -716,9 +716,9 @@ non_null()
|
|||
static void remove_from_closest(Group_c *g, int peer_index)
|
||||
{
|
||||
for (uint32_t i = 0; i < DESIRED_CLOSEST; ++i) {
|
||||
if (g->closest_peers[i].entry
|
||||
if (g->closest_peers[i].active
|
||||
&& id_equal(g->closest_peers[i].real_pk, g->group[peer_index].real_pk)) {
|
||||
g->closest_peers[i].entry = false;
|
||||
g->closest_peers[i].active = false;
|
||||
g->changed = GROUPCHAT_CLOSEST_CHANGE_REMOVED;
|
||||
break;
|
||||
}
|
||||
|
@ -1040,7 +1040,7 @@ static int g_handle_any_status(void *object, int friendcon_id, bool status, void
|
|||
{
|
||||
Group_Chats *g_c = (Group_Chats *)object;
|
||||
|
||||
if (status != 0) {
|
||||
if (status) {
|
||||
rejoin_frozen_friend(g_c, friendcon_id);
|
||||
}
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ static int g_handle_status(void *object, int friendcon_id, bool status, void *us
|
|||
{
|
||||
Group_Chats *g_c = (Group_Chats *)object;
|
||||
|
||||
if (status != 0) { /* Went online */
|
||||
if (status) { /* Went online */
|
||||
set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CONNECTION_ONLINE, userdata);
|
||||
} else { /* Went offline */
|
||||
set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CONNECTION_CONNECTING, userdata);
|
||||
|
@ -1073,7 +1073,7 @@ static int handle_lossy(void *object, int friendcon_id, const uint8_t *data, uin
|
|||
* return -1 on failure.
|
||||
*/
|
||||
static int add_conn_to_groupchat(Group_Chats *g_c, int friendcon_id, Group_c *g, uint8_t reason,
|
||||
uint8_t lock)
|
||||
bool lock)
|
||||
{
|
||||
uint16_t empty = MAX_GROUP_CONNECTIONS;
|
||||
uint16_t ind = MAX_GROUP_CONNECTIONS;
|
||||
|
@ -1095,7 +1095,7 @@ static int add_conn_to_groupchat(Group_Chats *g_c, int friendcon_id, Group_c *g,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (lock != 0) {
|
||||
if (lock) {
|
||||
friend_connection_lock(g_c->fr_c, friendcon_id);
|
||||
}
|
||||
|
||||
|
@ -1530,7 +1530,7 @@ static bool try_send_rejoin(Group_Chats *g_c, Group_c *g, const uint8_t *real_pk
|
|||
return false;
|
||||
}
|
||||
|
||||
add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCER, 1);
|
||||
add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCER, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1632,10 +1632,10 @@ static bool send_invite_response(Group_Chats *g_c, int groupnumber, uint32_t fri
|
|||
return false;
|
||||
}
|
||||
|
||||
const int connection_index = add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCER, 1);
|
||||
const int connection_index = add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCER, true);
|
||||
|
||||
if (member) {
|
||||
add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCING, 0);
|
||||
add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCING, false);
|
||||
}
|
||||
|
||||
if (connection_index != -1) {
|
||||
|
@ -2036,10 +2036,10 @@ static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, con
|
|||
|
||||
addpeer(g_c, groupnum, real_pk, temp_pk, peer_number, userdata, true, true);
|
||||
const int connection_index = add_conn_to_groupchat(g_c, friendcon_id, g,
|
||||
GROUPCHAT_CONNECTION_REASON_INTRODUCING, 1);
|
||||
GROUPCHAT_CONNECTION_REASON_INTRODUCING, true);
|
||||
|
||||
if (member) {
|
||||
add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCER, 0);
|
||||
add_conn_to_groupchat(g_c, friendcon_id, g, GROUPCHAT_CONNECTION_REASON_INTRODUCER, false);
|
||||
send_peer_query(g_c, friendcon_id, other_groupnum);
|
||||
}
|
||||
|
||||
|
@ -2200,7 +2200,7 @@ static int handle_packet_rejoin(Group_Chats *g_c, int friendcon_id, const uint8_
|
|||
|
||||
addpeer(g_c, groupnum, real_pk, temp_pk, peer_number, userdata, true, true);
|
||||
const int connection_index = add_conn_to_groupchat(g_c, friendcon_id, g,
|
||||
GROUPCHAT_CONNECTION_REASON_INTRODUCING, 1);
|
||||
GROUPCHAT_CONNECTION_REASON_INTRODUCING, true);
|
||||
|
||||
if (connection_index != -1) {
|
||||
send_packet_online(g_c->fr_c, friendcon_id, groupnum, g->type, g->id);
|
||||
|
|
|
@ -83,7 +83,10 @@ typedef struct Groupchat_Connection {
|
|||
} Groupchat_Connection;
|
||||
|
||||
typedef struct Groupchat_Closest {
|
||||
bool entry;
|
||||
/**
|
||||
* Whether this peer is active in the closest_peers array.
|
||||
*/
|
||||
bool active;
|
||||
uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE];
|
||||
uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE];
|
||||
} Groupchat_Closest;
|
||||
|
|
|
@ -1207,7 +1207,7 @@ static int64_t send_lossless_packet(Net_Crypto *c, int crypt_connection_id, cons
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (congestion_control && conn->maximum_speed_reached) {
|
||||
if (!congestion_control && conn->maximum_speed_reached) {
|
||||
return packet_num;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ typedef struct Onion_Node {
|
|||
IP_Port ip_port;
|
||||
uint8_t ping_id[ONION_PING_ID_SIZE];
|
||||
uint8_t data_public_key[CRYPTO_PUBLIC_KEY_SIZE];
|
||||
uint8_t is_stored;
|
||||
uint8_t is_stored; // Tribool.
|
||||
|
||||
uint64_t added_time;
|
||||
|
||||
|
|
|
@ -578,7 +578,7 @@ Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error)
|
|||
m_options.proxy_info.ip_port.ip.family = net_family_unspec;
|
||||
}
|
||||
|
||||
if (addr_resolve_or_parse_ip(tox_options_get_proxy_host(opts), &m_options.proxy_info.ip_port.ip, nullptr) == 0) {
|
||||
if (!addr_resolve_or_parse_ip(tox_options_get_proxy_host(opts), &m_options.proxy_info.ip_port.ip, nullptr)) {
|
||||
SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_HOST);
|
||||
// TODO(irungentoo): TOX_ERR_NEW_PROXY_NOT_FOUND if domain.
|
||||
tox_options_free(default_options);
|
||||
|
|
Loading…
Reference in New Issue
Block a user