Add a peer_count_out_in

This commit is contained in:
Ian Gulliver
2016-03-02 22:10:55 -08:00
parent eaf213f3c0
commit e62b84e4e8
2 changed files with 4 additions and 4 deletions

View File

@@ -14,7 +14,7 @@
#include "peer.h" #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_epoll_fd;
static int peer_shutdown_fd; static int peer_shutdown_fd;
@@ -97,10 +97,10 @@ void peer_call(struct peer *peer) {
void peer_loop() { void peer_loop() {
fprintf(stderr, "X %s: Starting event loop\n", server_id); fprintf(stderr, "X %s: Starting event loop\n", server_id);
while (!peer_shutdown_flag) { 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); fprintf(stderr, "X %s: No remaining inputs\n", server_id);
peer_shutdown(0); 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); fprintf(stderr, "X %s: No remaining outputs\n", server_id);
peer_shutdown(0); peer_shutdown(0);
} }

View File

@@ -14,7 +14,7 @@ struct peer {
bool always_trigger; 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_init(void);
void peer_cleanup(void); void peer_cleanup(void);