From e62b84e4e8aa11c59ef7fdbe86093f249b3ef911 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Wed, 2 Mar 2016 22:10:55 -0800 Subject: [PATCH] Add a peer_count_out_in --- adsbus/peer.c | 6 +++--- adsbus/peer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adsbus/peer.c b/adsbus/peer.c index 0f7a28b..3c8f70e 100644 --- a/adsbus/peer.c +++ b/adsbus/peer.c @@ -14,7 +14,7 @@ #include "peer.h" -uint32_t peer_count_in = 0, peer_count_out = 0; +uint32_t peer_count_in = 0, peer_count_out = 0, peer_count_out_in = 0; static int peer_epoll_fd; static int peer_shutdown_fd; @@ -97,10 +97,10 @@ void peer_call(struct peer *peer) { void peer_loop() { fprintf(stderr, "X %s: Starting event loop\n", server_id); while (!peer_shutdown_flag) { - if (!peer_count_in) { + if (!(peer_count_in + peer_count_out_in)) { fprintf(stderr, "X %s: No remaining inputs\n", server_id); peer_shutdown(0); - } else if (!peer_count_out) { + } else if (!(peer_count_out + peer_count_out_in)) { fprintf(stderr, "X %s: No remaining outputs\n", server_id); peer_shutdown(0); } diff --git a/adsbus/peer.h b/adsbus/peer.h index c75506b..1b380ea 100644 --- a/adsbus/peer.h +++ b/adsbus/peer.h @@ -14,7 +14,7 @@ struct peer { bool always_trigger; }; -extern uint32_t peer_count_in, peer_count_out; +extern uint32_t peer_count_in, peer_count_out, peer_count_out_in; void peer_init(void); void peer_cleanup(void);