mirror of
https://github.com/schoebel/mars
synced 2025-03-06 05:17:38 +00:00
main: fix and improve misleading connection state wording
This commit is contained in:
parent
22a04ee942
commit
0c09be8eae
@ -2188,6 +2188,15 @@ bool peer_thead_should_run(struct mars_peerinfo *peer)
|
||||
return mars_net_is_alive && !peer->to_terminate && !brick_thread_should_stop();
|
||||
}
|
||||
|
||||
static
|
||||
void report_peer_connection(struct key_value_pair *peer_pairs, bool do_additional)
|
||||
{
|
||||
const char *peer_role =
|
||||
do_additional ? "additional-connection-with-" : "needed-connection-with-";
|
||||
|
||||
show_vals(peer_pairs, "/mars", peer_role);
|
||||
}
|
||||
|
||||
static
|
||||
int peer_thread(void *data)
|
||||
{
|
||||
@ -2232,7 +2241,8 @@ int peer_thread(void *data)
|
||||
init_rwsem(&tmp_global.dent_mutex);
|
||||
init_rwsem(&tmp_global.brick_mutex);
|
||||
|
||||
show_vals(peer_pairs, "/mars", "connection-from-");
|
||||
report_peer_connection(peer_pairs, peer->do_additional);
|
||||
report_peer_connection(peer_pairs, !peer->do_additional);
|
||||
|
||||
if (!mars_socket_is_alive(&peer->socket)) {
|
||||
make_msg(peer_pairs, "connection to '%s' (%s) is dead", peer->peer, real_peer);
|
||||
@ -2421,7 +2431,8 @@ int peer_thread(void *data)
|
||||
MARS_INF("-------- peer thread terminating\n");
|
||||
|
||||
make_msg(peer_pairs, "NOT connected %s(%s)", peer->peer, real_peer);
|
||||
show_vals(peer_pairs, "/mars", "connection-from-");
|
||||
report_peer_connection(peer_pairs, peer->do_additional);
|
||||
report_peer_connection(peer_pairs, !peer->do_additional);
|
||||
|
||||
peer->do_additional = false;
|
||||
if (peer->doing_additional) {
|
||||
|
Loading…
Reference in New Issue
Block a user