From 1b584010955d60256eed1bc206b4baea2a27b708 Mon Sep 17 00:00:00 2001 From: angt Date: Thu, 24 Mar 2016 14:38:43 +0000 Subject: [PATCH] Add mud_is_up() --- mud.c | 12 ++++++++++++ mud.h | 1 + 2 files changed, 13 insertions(+) diff --git a/mud.c b/mud.c index 0f96de8..1965d30 100644 --- a/mud.c +++ b/mud.c @@ -649,6 +649,18 @@ int mud_can_pull (struct mud *mud) return (mud->rx.start != MUD_PACKET_NEXT(mud->rx.end)); } +int mud_is_up (struct mud *mud) +{ + struct path *path; + + int ret = 0; + + for (path = mud->path; path; path = path->next) + ret += path->up; + + return ret; +} + int mud_pull (struct mud *mud) { unsigned char ctrl[1024]; diff --git a/mud.h b/mud.h index 61cc71f..ba65f0a 100644 --- a/mud.h +++ b/mud.h @@ -14,6 +14,7 @@ int mud_bind (struct mud *, const char *); int mud_peer (struct mud *, const char *, const char *); int mud_can_pull (struct mud *); +int mud_is_up (struct mud *); int mud_pull (struct mud *); int mud_push (struct mud *);