mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Minor cleanup: return early on error condition.
This commit is contained in:
parent
2f80e2206c
commit
a725d73235
|
@ -2063,25 +2063,19 @@ int set_direct_ip_port(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (add_ip_port_connection(c, crypt_connection_id, ip_port) == 0) {
|
||||
if (connected) {
|
||||
if (net_family_is_ipv4(ip_port.ip.family)) {
|
||||
conn->direct_lastrecv_timev4 = unix_time();
|
||||
} else {
|
||||
conn->direct_lastrecv_timev6 = unix_time();
|
||||
}
|
||||
} else {
|
||||
if (net_family_is_ipv4(ip_port.ip.family)) {
|
||||
conn->direct_lastrecv_timev4 = 0;
|
||||
} else {
|
||||
conn->direct_lastrecv_timev6 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (add_ip_port_connection(c, crypt_connection_id, ip_port) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
const uint64_t direct_lastrecv_time = connected ? unix_time() : 0;
|
||||
|
||||
if (net_family_is_ipv4(ip_port.ip.family)) {
|
||||
conn->direct_lastrecv_timev4 = direct_lastrecv_time;
|
||||
} else {
|
||||
conn->direct_lastrecv_timev6 = direct_lastrecv_time;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user