From e5b238e04aa3400777b95735af784316e6dc0e27 Mon Sep 17 00:00:00 2001
From: Christof Schulze <christof.schulze@gmx.net>
Date: Thu, 22 Nov 2018 23:51:54 +0100
Subject: [PATCH] gluon-mesh-babel: exit with error if unable to connect to
 babeld

---
 package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel b/package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel
index 338bc4538..2d04ff538 100755
--- a/package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel
+++ b/package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel
@@ -22,11 +22,15 @@ start_service() {
 echotobabel() {
 	local count=0
 	local line="$1"
+	local maxretries=10
 	while ! (echo -e "$line" | busybox nc ::1 "$PORT" >/dev/null 2>&1)
 	do
 		sleep 1
 		echo retrying to connect to babeld in PID $$, waited ${count}s >&2
 		count=$((count+1))
+		if [ $count -gt $maxretries ]; then
+			return 1
+		fi
 	done
 	return 0
 }
-- 
GitLab