mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Dont treat bools as a magic number and simplify negated tests where possible
This commit is contained in:
parent
1a598fa43b
commit
beb14c8d70
|
@ -607,7 +607,7 @@ void readFromMgmtSocket (n2n_edge_t *eee) {
|
||||||
msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len),
|
msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len),
|
||||||
"%-19s %1s%1s | %-17s | %-21s | %-15s | %9s | %10s\n",
|
"%-19s %1s%1s | %-17s | %-21s | %-15s | %9s | %10s\n",
|
||||||
peer->version,
|
peer->version,
|
||||||
(peer->purgeable == false) ? "l" : "",
|
(peer->purgeable) ? "" : "l",
|
||||||
(peer == eee->curr_sn) ? (eee->sn_wait ? "." : "*" ) : "",
|
(peer == eee->curr_sn) ? (eee->sn_wait ? "." : "*" ) : "",
|
||||||
is_null_mac(peer->mac_addr) ? "" : macaddr_str(mac_buf, peer->mac_addr),
|
is_null_mac(peer->mac_addr) ? "" : macaddr_str(mac_buf, peer->mac_addr),
|
||||||
sock_to_cstr(sockbuf, &(peer->sock)),
|
sock_to_cstr(sockbuf, &(peer->sock)),
|
||||||
|
|
|
@ -688,7 +688,7 @@ size_t clear_peer_list (struct peer_info ** peer_list) {
|
||||||
size_t retval = 0;
|
size_t retval = 0;
|
||||||
|
|
||||||
HASH_ITER(hh, *peer_list, scan, tmp) {
|
HASH_ITER(hh, *peer_list, scan, tmp) {
|
||||||
if (scan->purgeable == false && scan->ip_addr) {
|
if (!scan->purgeable && scan->ip_addr) {
|
||||||
free(scan->ip_addr);
|
free(scan->ip_addr);
|
||||||
}
|
}
|
||||||
HASH_DEL(*peer_list, scan);
|
HASH_DEL(*peer_list, scan);
|
||||||
|
|
|
@ -371,7 +371,7 @@ int process_mgmt (n2n_sn_t *sss,
|
||||||
|
|
||||||
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize,
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize,
|
||||||
"%s '%s'\n",
|
"%s '%s'\n",
|
||||||
(community->is_federation) ? "FEDERATION" : ((community->purgeable == false) ? "FIXED NAME COMMUNITY" : "COMMUNITY"),
|
(community->is_federation) ? "FEDERATION" : ((community->purgeable) ? "COMMUNITY" : "FIXED NAME COMMUNITY"),
|
||||||
(community->is_federation) ? "-/-" : community->community);
|
(community->is_federation) ? "-/-" : community->community);
|
||||||
sendto_mgmt(sss, sender_sock, sock_size, (const uint8_t *) resbuf, ressize);
|
sendto_mgmt(sss, sender_sock, sock_size, (const uint8_t *) resbuf, ressize);
|
||||||
ressize = 0;
|
ressize = 0;
|
||||||
|
@ -382,7 +382,7 @@ int process_mgmt (n2n_sn_t *sss,
|
||||||
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize,
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize,
|
||||||
"%4u | %-19s | %-17s | %-21s %-3s | %-15s | %9s\n",
|
"%4u | %-19s | %-17s | %-21s %-3s | %-15s | %9s\n",
|
||||||
++num,
|
++num,
|
||||||
(peer->dev_addr.net_addr == 0) ? ((peer->purgeable == false) ? "-l" : "") : ip_subnet_to_str(ip_bit_str, &peer->dev_addr),
|
(peer->dev_addr.net_addr == 0) ? ((peer->purgeable) ? "" : "-l") : ip_subnet_to_str(ip_bit_str, &peer->dev_addr),
|
||||||
(is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr),
|
(is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr),
|
||||||
sock_to_cstr(sockbuf, &(peer->sock)),
|
sock_to_cstr(sockbuf, &(peer->sock)),
|
||||||
((peer->socket_fd >= 0) && (peer->socket_fd != sss->sock)) ? "TCP" : "",
|
((peer->socket_fd >= 0) && (peer->socket_fd != sss->sock)) ? "TCP" : "",
|
||||||
|
|
|
@ -1483,7 +1483,7 @@ static int purge_expired_communities (n2n_sn_t *sss,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((comm->edges == NULL) && (comm->purgeable == true)) {
|
if((comm->edges == NULL) && (comm->purgeable)) {
|
||||||
traceEvent(TRACE_INFO, "purging idle community %s", comm->community);
|
traceEvent(TRACE_INFO, "purging idle community %s", comm->community);
|
||||||
if(NULL != comm->header_encryption_ctx_static) {
|
if(NULL != comm->header_encryption_ctx_static) {
|
||||||
/* this should not happen as 'purgeable' and thus only communities w/o encrypted header here */
|
/* this should not happen as 'purgeable' and thus only communities w/o encrypted header here */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user