Commit 73e33c09256811288df631f1b5e885a26502313f

Con Kolivas 2011-09-06T11:30:48

Retry also if the decoding of work fails.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/main.c b/main.c
index 9ed80bb..c5323df 100644
--- a/main.c
+++ b/main.c
@@ -2001,6 +2001,7 @@ static bool get_upstream_work(struct work *work, bool lagging)
 	if (opt_debug)
 		applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req);
 
+retry:
 	/* A single failure response here might be reported as a dead pool and
 	 * there may be temporary denied messages etc. falsely reporting
 	 * failure so retry a few times before giving up */
@@ -2013,6 +2014,8 @@ static bool get_upstream_work(struct work *work, bool lagging)
 	}
 
 	rc = work_decode(json_object_get(val, "result"), work);
+	if (!rc && retries < 3)
+		goto retry;
 	work->pool = pool;
 	total_getworks++;
 	pool->getwork_requested++;