aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-08-23 14:22:29 +0200
committerMartin Willi <martin@revosec.ch>2013-08-23 14:27:17 +0200
commit49032d15be34cdb0ba9f233e837e3949ee14067c (patch)
treed0ee8a9c3d0fb459ad2b95b3dd5b23431e5af57d /src
parent03d673620debfd29cbec541b2956fc94a1087831 (diff)
downloadstrongswan-49032d15be34cdb0ba9f233e837e3949ee14067c.tar.bz2
strongswan-49032d15be34cdb0ba9f233e837e3949ee14067c.tar.xz
stroke: stop enumerating IKE_SAs in statusall if output stream gets closed
If the output stream is not interested in more information, it can close the the stream. Checking for stream errors avoids useless enumeration of IKE_SAs, saving resources. This allows to use "ipsec statusall | head" to monitor the daemon, or stop enumerating IKE_SAs after a specific entry has been found.
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/stroke/stroke_list.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c
index e81f3fc32..7431514b6 100644
--- a/src/libcharon/plugins/stroke/stroke_list.c
+++ b/src/libcharon/plugins/stroke/stroke_list.c
@@ -647,7 +647,7 @@ METHOD(stroke_list_t, status, void,
half_open);
enumerator = charon->controller->create_ike_sa_enumerator(
charon->controller, wait);
- while (enumerator->enumerate(enumerator, &ike_sa))
+ while (enumerator->enumerate(enumerator, &ike_sa) && ferror(out) == 0)
{
bool ike_printed = FALSE;
enumerator_t *children = ike_sa->create_child_sa_enumerator(ike_sa);